diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 935e3088..1b711143 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -87,6 +87,7 @@ jobs: - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 + if: ${{ !env.ACT }} with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -97,18 +98,20 @@ jobs: with: context: . platforms: ${{ matrix.platform }} - outputs: type=image,name=mauriceboe/trek,push-by-digest=true,name-canonical=true,push=true + outputs: ${{ env.ACT == 'true' && 'type=docker' || 'type=image,name=mauriceboe/trek,push-by-digest=true,name-canonical=true,push=true' }} no-cache: true build-args: | APP_VERSION=${{ needs.version-bump.outputs.version }} - name: Export digest + if: ${{ !env.ACT }} run: | mkdir -p /tmp/digests digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - name: Upload digest artifact + if: ${{ !env.ACT }} uses: actions/upload-artifact@v4 with: name: digests-${{ env.PLATFORM_PAIR }} @@ -117,6 +120,7 @@ jobs: retention-days: 1 merge: + if: ${{ !env.ACT }} runs-on: ubuntu-latest needs: [version-bump, build] steps: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 21e518bf..19c42276 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -107,13 +107,15 @@ jobs: sed -i "s/^version: .*/version: $NEW_VERSION/" charts/trek/Chart.yaml sed -i "s/^appVersion: .*/appVersion: \"$NEW_VERSION\"/" charts/trek/Chart.yaml - # Commit and tag - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add package.json package-lock.json server/package.json client/package.json shared/package.json charts/trek/Chart.yaml - git commit -m "chore: bump version to $NEW_VERSION [skip ci]" - git tag "v$NEW_VERSION" - git push origin main --follow-tags + # Commit and tag (skipped when running locally with act) + if [ -z "$ACT" ]; then + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add package.json package-lock.json server/package.json client/package.json shared/package.json charts/trek/Chart.yaml + git commit -m "chore: bump version to $NEW_VERSION [skip ci]" + git tag "v$NEW_VERSION" + git push origin main --follow-tags + fi build: runs-on: ${{ matrix.runner }} @@ -137,6 +139,7 @@ jobs: - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 + if: ${{ !env.ACT }} with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -147,18 +150,22 @@ jobs: with: context: . platforms: ${{ matrix.platform }} - outputs: type=image,name=mauriceboe/trek,push-by-digest=true,name-canonical=true,push=true + # act (local): load image into local Docker daemon instead of pushing. + # CI: push by digest to Docker Hub for multi-arch manifest assembly. + outputs: ${{ env.ACT == 'true' && 'type=docker' || 'type=image,name=mauriceboe/trek,push-by-digest=true,name-canonical=true,push=true' }} no-cache: true build-args: | APP_VERSION=${{ needs.version-bump.outputs.version }} - name: Export digest + if: ${{ !env.ACT }} run: | mkdir -p /tmp/digests digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" - name: Upload digest artifact + if: ${{ !env.ACT }} uses: actions/upload-artifact@v4 with: name: digests-${{ env.PLATFORM_PAIR }} @@ -167,6 +174,7 @@ jobs: retention-days: 1 merge: + if: ${{ !env.ACT }} runs-on: ubuntu-latest needs: [version-bump, build] steps: @@ -204,6 +212,7 @@ jobs: run: docker buildx imagetools inspect mauriceboe/trek:latest release-helm: + if: ${{ !env.ACT }} runs-on: ubuntu-latest needs: version-bump steps: