Skip to content

build(deps): Update dependencies #344

build(deps): Update dependencies

build(deps): Update dependencies #344

Workflow file for this run

name: Release
on:
push:
branches:
- develop
- main
jobs:
generate-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: '20'
- run: npm ci
- name: set version
run: |
mkdir ./artifact
node ./.github/workflows/get-version.js
echo "$(jq ".version = \"$(cat ./version)\"" package.json )" > ./artifact/package.json
echo "$(jq ".version = \"$(cat ./version)\"" package-lock.json )" > ./artifact/package-lock.json
rm -f ./version
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: version
path: ./artifact
if-no-files-found: error
build-containers:
runs-on: ubuntu-latest
needs: [generate-version]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: version
path: version
- name: πŸ”§ Set up QEMU
uses: actions/download-artifact@v4
- name: πŸ”§ Set up Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: πŸ” Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: πŸ” Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: ℹ️ Set Build Variables
id: buildVars
run: |
echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "version=$(cat ./version/release.json| jq .version -r)" >> $GITHUB_OUTPUT
export BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
if [[ "${BRANCH}" == "main" ]]
then
echo "clientTag=latest" >> $GITHUB_OUTPUT
echo "next=" >> $GITHUB_OUTPUT
else
echo "clientTag=next" >> $GITHUB_OUTPUT
echo "next=1" >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
mv -f ./version/package.json ./
mv -f ./version/package-lock.json ./
rm -rf ./version
- name: πŸͺ„ Build and push
id: docker-build-gh
uses: docker/build-push-action@v5
with:
context: .
github-token: ${{ secrets.GITHUB_TOKEN }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64,linux/i386
pull: true
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:cache-${{ hashFiles('package*.json') }}
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
org.opencontainers.image.created=${{ steps.buildVars.outputs.date }}
org.opencontainers.image.ref.name=${{ github.ref }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
cache-from: |
ghcr.io/${{ github.repository }}:cache-${{ hashFiles('package*.json') }}
ghcr.io/${{ github.repository }}:next
build-args: |
NODE_ENV=production
CLIENT_TAG=${{ steps.buildVars.outputs.clientTag }}
NEXT=${{ steps.buildVars.outputs.next }}
BUILD_DATE=${{ steps.buildVars.outputs.date }}
VCS_REF=${{ github.sha }}
VERSION=${{ steps.buildVars.outputs.version }}
- name: πŸ”„ Push container to DockerHub
id: docker-build-dh
uses: docker/build-push-action@v5
with:
context: .
github-token: ${{ secrets.GITHUB_TOKEN }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64,linux/i386
push: true
tags: ubud/server:${{ github.sha }}
labels: |
org.opencontainers.image.authors=${{ github.repository_owner }}
org.opencontainers.image.created=${{ steps.buildVars.outputs.date }}
org.opencontainers.image.ref.name=${{ github.ref }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
cache-from: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:cache-${{ hashFiles('package*.json') }}
cache-to: type=inline
build-args: |
NODE_ENV=production
CLIENT_TAG=${{ steps.buildVars.outputs.clientTag }}
NEXT=${{ steps.buildVars.outputs.next }}
BUILD_DATE=${{ steps.buildVars.outputs.date }}
VCS_REF=${{ github.sha }}
VERSION=${{ steps.buildVars.outputs.version }}
release:
runs-on: ubuntu-latest
needs: [build-containers]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: '20'
- name: πŸ”§ Setup regclient
run: |
mkdir -p "$HOME/.local/bin"
curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 > "$HOME/.local/bin/regctl"
chmod +x "$HOME/.local/bin/regctl"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/download-artifact@v4
with:
name: version
path: version
- name: install dependencies
run: npm ci
- name: install sentry cli
run: npm install -g @sentry/cli
- name: πŸ” Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: πŸ” Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: semantic-release
run: BRANCH=${GITHUB_REF#refs/heads/} npx semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ubud
SENTRY_PROJECT: server
SENTRY_URL: ${{ secrets.SENTRY_URL }}
DOCKER_LOCAL_IMAGE_DH: ubud/server:${{ github.sha }}
DOCKER_LOCAL_IMAGE_GH: ghcr.io/${{ github.repository }}:${{ github.sha }}
NOTIFY_WEBHOOK_SECRET: ${{ secrets.NOTIFY_WEBHOOK_SECRET }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
MICROBADGER_WEBHOOK_SECRET: ${{ secrets.MICROBADGER_WEBHOOK_SECRET }}
- name: update develop
if: ${{ github.ref == 'ref/head/main' }}
uses: everlytic/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_ref: 'main'
target_branch: 'develop'
commit_message_template: 'Merge branch {source_ref} into {target_branch} [skip ci]'