From 7619be6d11b85e1158889f20393079f584774f4e Mon Sep 17 00:00:00 2001 From: trev Date: Sat, 17 May 2025 02:57:37 -0400 Subject: [PATCH] fix: checkout first --- .github/actions/init/action.yaml | 9 +++------ .github/workflows/check.yaml | 1 + .github/workflows/release.yaml | 19 +++++++++++-------- .github/workflows/update.yaml | 9 +++++---- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/actions/init/action.yaml b/.github/actions/init/action.yaml index 921d20a..44078ef 100644 --- a/.github/actions/init/action.yaml +++ b/.github/actions/init/action.yaml @@ -1,16 +1,13 @@ -name: "Initialize" +name: "initialize" runs: using: "composite" steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Nix + - name: install nix uses: cachix/install-nix-action@v31 with: nix_path: nixpkgs=channel:nixos-unstable - - name: Use Cachix + - name: use cachix uses: cachix/cachix-action@v16 with: name: trevstack diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 017ce0e..645ffb0 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -15,6 +15,7 @@ jobs: contains(github.event.head_commit.message, 'bump:') == false && contains(github.event.head_commit.message, 'Merge pull request') == false steps: + - uses: actions/checkout@v4 - uses: ./.github/actions/init - name: Check diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ec6fd4d..b090371 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,18 +13,20 @@ jobs: check: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: ./.github/actions/init - - name: Check + - name: check run: nix flake check release: runs-on: ubuntu-latest needs: check steps: + - uses: actions/checkout@v4 - uses: ./.github/actions/init - - name: Build + - name: build run: > nix build .#trevstack-linux-amd64 @@ -34,7 +36,7 @@ jobs: .#trevstack-darwin-amd64 .#trevstack-darwin-arm64 - - name: Release + - name: release uses: softprops/action-gh-release@v2 with: generate_release_notes: true @@ -45,9 +47,10 @@ jobs: runs-on: ubuntu-latest needs: release steps: + - uses: actions/checkout@v4 - uses: ./.github/actions/init - - name: Set env + - name: set env run: | TAG=${{ github.ref_name }} VERSION=${TAG#v} @@ -56,20 +59,20 @@ jobs: echo "VERSION=${VERSION}" >> $GITHUB_ENV echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV - - name: Login to GitHub Container Registry + - name: login to github container registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build & Load Images + - name: build & load images run: | nix build .#trevstack-linux-amd64-image && ./result | docker load nix build .#trevstack-linux-arm64-image && ./result | docker load nix build .#trevstack-linux-arm-image && ./result | docker load - - name: Push Images + - name: push images run: | docker image tag trevstack:$VERSION-amd64 $REGISTRY/$GITHUB_REPOSITORY:$VERSION-amd64 docker push $REGISTRY/$GITHUB_REPOSITORY:$VERSION-amd64 @@ -80,7 +83,7 @@ jobs: docker image tag trevstack:$VERSION-arm $REGISTRY/$GITHUB_REPOSITORY:$VERSION-arm docker push $REGISTRY/$GITHUB_REPOSITORY:$VERSION-arm - - name: Push Manifest + - name: push manifest run: | docker manifest create $REGISTRY/$GITHUB_REPOSITORY:$VERSION \ $REGISTRY/$GITHUB_REPOSITORY:$VERSION-amd64 \ diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml index 3509943..d64c579 100644 --- a/.github/workflows/update.yaml +++ b/.github/workflows/update.yaml @@ -13,18 +13,19 @@ jobs: update: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: ./.github/actions/init # https://github.com/actions/checkout/issues/13 - - name: Set Git Config + - name: set git config run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Update + - name: update run: nix run .#update - - name: Create Pull Request + - name: create pull request id: cpr uses: peter-evans/create-pull-request@v7 with: @@ -32,7 +33,7 @@ jobs: title: update body: automatic update - - name: Enable Automerge + - name: enable automerge run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}" env: GH_TOKEN: ${{ secrets.PAT }}