From 166d9b49f2cbe1c42c23add6a69952029edcc21f Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sun, 26 Nov 2023 09:30:19 +0100 Subject: [PATCH] ci(beta): adapt workflow with new worker build --- .github/workflows/alpha-release.yml | 2 - .github/workflows/beta-release.yml | 78 ++++++++++++++++------------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/.github/workflows/alpha-release.yml b/.github/workflows/alpha-release.yml index 4f733dba..9e32f04c 100644 --- a/.github/workflows/alpha-release.yml +++ b/.github/workflows/alpha-release.yml @@ -59,7 +59,6 @@ jobs: build-images: runs-on: ubuntu-latest needs: create-tag - steps: - name: Checkout code uses: actions/checkout@v4 @@ -90,7 +89,6 @@ jobs: build-cli: runs-on: ubuntu-latest needs: create-tag - steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index 9cd25156..1d3701c3 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -8,27 +8,55 @@ on: required: true jobs: - get-tag: + create-tag: runs-on: ubuntu-latest outputs: - tag: ${{ steps.get_tag.outputs.tag }} + tagname: ${{ steps.create_tag.outputs.tagname }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 + - name: Create Tag + id: create_tag + uses: Klemensas/action-autotag@stable with: - node-version: 18 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag_prefix: 'v' + tag_suffix: '-beta.${{ github.event.inputs.tag }}' - - name: Get tag from VERSION file - id: get_tag - run: | - VERSION=$(npm run version --silent) - echo "tag=v${VERSION}-beta.${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + build-worker: + runs-on: ubuntu-latest + needs: create-tag + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push images + uses: docker/build-push-action@v5 + with: + context: . + file: ./packages/worker/Dockerfile + platforms: linux/amd64 + push: true + tags: ghcr.io/${{ github.repository_owner }}/worker:${{ needs.create-tag.outputs.tagname }} + cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/worker:buildcache + cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/worker:buildcache,mode=max build-images: - needs: get-tag + needs: create-tag runs-on: ubuntu-latest steps: - name: Checkout code @@ -51,15 +79,15 @@ jobs: uses: docker/build-push-action@v5 with: context: . - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 push: true - tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.get-tag.outputs.tag }} + tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.create-tag.outputs.tagname }} cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache,mode=max build-cli: runs-on: ubuntu-latest - needs: get-tag + needs: create-tag steps: - name: Checkout code uses: actions/checkout@v4 @@ -93,7 +121,7 @@ jobs: run: pnpm install - name: Set version - run: pnpm -r --filter cli set-version ${{ needs.get-tag.outputs.tag }} + run: pnpm -r --filter cli set-version ${{ needs.create-tag.outputs.tagname }} - name: Build CLI run: pnpm -r --filter cli package @@ -104,27 +132,9 @@ jobs: name: cli path: packages/cli/dist - create-tag: - needs: [build-images, build-cli] - runs-on: ubuntu-latest - outputs: - tagname: ${{ steps.create_tag.outputs.tagname }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Create Tag - id: create_tag - uses: Klemensas/action-autotag@stable - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - tag_prefix: 'v' - tag_suffix: '-beta.${{ github.event.inputs.tag }}' - publish-release: runs-on: ubuntu-latest - needs: [create-tag, build-images, build-cli] + needs: [create-tag, build-images, build-cli, build-worker] outputs: id: ${{ steps.create_release.outputs.id }} steps: