Release #662
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - staging | |
| - 'release/**' | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: write | |
| packages: write | |
| jobs: | |
| build: | |
| name: Build and Release | |
| runs-on: ubuntu-latest | |
| env: | |
| CI: true | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: 20.x | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Fix node-gyp (Windows Only) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| npm install -g node-gyp | |
| npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"} | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: NPM Install | |
| run: | | |
| corepack enable | |
| npm run bootstrap | |
| - name: Find Version | |
| run: | | |
| echo "GIT_TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV | |
| - name: Make GitHub Release | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| run: | | |
| CHANGELOG=$(./script/most_recent_changelog.sh) | |
| node ./src/make-github-release/bin/make-github-release.js release --owner "${{ github.repository_owner }}" --repo "${{ github.event.repository.name }}" --text "${CHANGELOG}" --auth "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Test | |
| run: | | |
| npx --node-options="--max_old_space_size=4096" jest --detectOpenHandles --forceExit --no-cache | |
| - name: Build | |
| run: | | |
| npm run build | |
| env: | |
| OMIT_BUILD_CSP: 'true' | |
| OMIT_SIMPLE_ANALYTICS: 'true' | |
| - name: Publish Master NPM Packages | |
| if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/') }} | |
| run: | | |
| echo "Publishing NPM Packages..." | |
| pnpm -r publish --no-git-checks | |
| echo "Updating package-lock.json..." | |
| # Sleep for 5 seconds to hopefully give NPM time to update the package listing | |
| sleep 5 | |
| cd ./src/aux-server | |
| for i in {1..5}; do | |
| npm install --package-lock-only && break || sleep 5; | |
| done | |
| - name: Publish Alpha NPM Packages | |
| if: ${{ github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/') }} | |
| run: | | |
| echo "Publishing NPM Packages..." | |
| ls -la | |
| pnpm -r publish --tag alpha --no-git-checks | |
| echo "Updating package-lock.json..." | |
| # Sleep for 5 seconds to hopefully give NPM time to update the package listing | |
| sleep 5 | |
| cd ./src/aux-server | |
| for i in {1..5}; do | |
| npm install --package-lock-only && break || sleep 5; | |
| done | |
| - name: Build Docker | |
| run: | | |
| echo "Building..." | |
| docker build -t "casualsimulation/aux:${{ env.GIT_TAG }}" -t "casualsimulation/aux:latest" -t "casualsimulation/aux:alpha" . | |
| docker build -t "casualsimulation/aux-proxy:${{ env.GIT_TAG }}" -t "casualsimulation/aux-proxy:latest" -t "casualsimulation/aux-proxy:alpha" ./src/aux-proxy | |
| docker build -t "casualsimulation/aux-redirector:${{ env.GIT_TAG }}" -t "casualsimulation/aux-redirector:latest" -t "casualsimulation/aux-redirector:alpha" ./src/aux-redirector | |
| - name: Login to DockerHub | |
| run: | | |
| echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
| - name: Publish DockerHub | |
| run: | | |
| echo "Publishing the x64 Docker Image...." | |
| docker push casualsimulation/aux:${{ env.GIT_TAG }} | |
| docker push casualsimulation/aux-proxy:${{ env.GIT_TAG }} | |
| docker push casualsimulation/aux-redirector:${{ env.GIT_TAG }} | |
| - name: Publish DockerHub Latest | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| run: | | |
| echo "Publishing the latest tags...." | |
| docker push casualsimulation/aux:latest | |
| docker push casualsimulation/aux-proxy:latest | |
| docker push casualsimulation/aux-redirector:latest | |
| - name: Publish DockerHub Alpha | |
| if: ${{ github.ref != 'refs/heads/master' }} | |
| run: | | |
| echo "Publishing the alpha tags...." | |
| docker push casualsimulation/aux:alpha | |
| docker push casualsimulation/aux-proxy:alpha | |
| docker push casualsimulation/aux-redirector:alpha | |
| - name: Login to GHCR | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Set GHCR Environment Variables | |
| run: | | |
| echo "Publishing the x64 Docker Image...." | |
| CASUALOS_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/casualos | |
| CASUALOS_IMAGE_ID=$(echo $CASUALOS_IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| PROXY_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/casualos-proxy | |
| PROXY_IMAGE_ID=$(echo $PROXY_IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| REDIRECTOR_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/casualos-redirector | |
| REDIRECTOR_IMAGE_ID=$(echo $REDIRECTOR_IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| docker tag casualsimulation/aux $CASUALOS_IMAGE_ID:${{ env.GIT_TAG }} | |
| docker tag casualsimulation/aux-proxy $PROXY_IMAGE_ID:${{ env.GIT_TAG }} | |
| docker tag casualsimulation/aux-redirector $REDIRECTOR_IMAGE_ID:${{ env.GIT_TAG }} | |
| docker tag casualsimulation/aux $CASUALOS_IMAGE_ID:latest | |
| docker tag casualsimulation/aux-proxy $PROXY_IMAGE_ID:latest | |
| docker tag casualsimulation/aux-redirector $REDIRECTOR_IMAGE_ID:latest | |
| docker tag casualsimulation/aux $CASUALOS_IMAGE_ID:alpha | |
| docker tag casualsimulation/aux-proxy $PROXY_IMAGE_ID:alpha | |
| docker tag casualsimulation/aux-redirector $REDIRECTOR_IMAGE_ID:alpha | |
| echo "CASUALOS_IMAGE_ID=$CASUALOS_IMAGE_ID" >> $GITHUB_ENV | |
| echo "PROXY_IMAGE_ID=$PROXY_IMAGE_ID" >> $GITHUB_ENV | |
| echo "REDIRECTOR_IMAGE_ID=$REDIRECTOR_IMAGE_ID" >> $GITHUB_ENV | |
| - name: Publish GHCR | |
| run: | | |
| docker push $CASUALOS_IMAGE_ID:${{ env.GIT_TAG }} | |
| docker push $PROXY_IMAGE_ID:${{ env.GIT_TAG }} | |
| docker push $REDIRECTOR_IMAGE_ID:${{ env.GIT_TAG }} | |
| - name: Publish GHCR Latest | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| run: | | |
| echo "Publishing the latest tags...." | |
| docker push $CASUALOS_IMAGE_ID:latest | |
| docker push $PROXY_IMAGE_ID:latest | |
| docker push $REDIRECTOR_IMAGE_ID:latest | |
| - name: Publish GHCR Alpha | |
| if: ${{ github.ref != 'refs/heads/master' }} | |
| run: | | |
| echo "Publishing the alpha tags...." | |
| docker push $CASUALOS_IMAGE_ID:alpha | |
| docker push $PROXY_IMAGE_ID:alpha | |
| docker push $REDIRECTOR_IMAGE_ID:alpha | |
| docs: | |
| name: Deploy Docs | |
| runs-on: ubuntu-latest | |
| env: | |
| CI: true | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: 20.x | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Fix node-gyp (Windows Only) | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| npm install -g node-gyp | |
| npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"} | |
| - name: NPM Install | |
| run: | | |
| corepack enable | |
| npm run bootstrap | |
| - name: Find Version | |
| run: | | |
| echo "GIT_TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV | |
| - name: Publish Docs | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| run: | | |
| cd docs | |
| git config --global user.name DevOps | |
| git config --global user.email devops@casualsimulation.org | |
| git remote set-url origin https://x-access-token:${{ secrets.DEPLOY_SECRET }}@github.com/${{ github.repository }} | |
| echo "Building and deploying..." | |
| GIT_USER="DevOps" GIT_PASS="${{ secrets.DEPLOY_SECRET }}" npm run deploy | |
| arm32: | |
| name: ARM32 Docker Build | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: false | |
| steps: | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Run CodeBuild | |
| uses: aws-actions/aws-codebuild-run-build@v1.0.13 | |
| with: | |
| project-name: publish-casualos-docker-arm32 | |
| disable-github-env-vars: true | |
| arm64: | |
| name: ARM64 Docker Build | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Run CodeBuild | |
| uses: aws-actions/aws-codebuild-run-build@v1.0.13 | |
| with: | |
| project-name: publish-casualos-docker-arm64 | |
| disable-github-env-vars: true |