From 0955303c60e26c56b865fca84e55f87caeeddd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20N=C3=BCtzi?= Date: Fri, 5 Jul 2024 11:58:46 +0200 Subject: [PATCH] fix: remove before script --- .github/workflows/normal.yaml | 51 ++++++++++++--------- README.md | 3 ++ tools/ci/{before-script.sh => setup-git.sh} | 5 -- 3 files changed, 33 insertions(+), 26 deletions(-) rename tools/ci/{before-script.sh => setup-git.sh} (78%) diff --git a/.github/workflows/normal.yaml b/.github/workflows/normal.yaml index 70a48a4..7c51518 100644 --- a/.github/workflows/normal.yaml +++ b/.github/workflows/normal.yaml @@ -40,10 +40,12 @@ jobs: with: fetch-depth: 0 + - name: Setup Git + run: | + just nix-develop ./tools/ci/setup-git.sh + - name: Format run: | - source tools/ci/before-script.sh && - cat justfile && just nix-develop just format lint: @@ -56,15 +58,17 @@ jobs: with: fetch-depth: 0 + - name: Setup Git + run: | + just nix-develop ./tools/ci/setup-git.sh + - name: Lint run: | - source tools/ci/before-script.sh && just nix-develop just lint - name: Lint Undefined-Behavior continue-on-error: true run: | - source tools/ci/before-script.sh && just nix-develop just lint-ub - name: Allow to fail @@ -78,14 +82,18 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Git + run: | + just nix-develop ./tools/ci/setup-git.sh - name: build run: | - source tools/ci/before-script.sh && just nix-develop just build - name: tests run: | - source tools/ci/before-script.sh && just nix-develop just test test: @@ -98,9 +106,12 @@ jobs: with: fetch-depth: 0 + - name: Setup Git + run: | + just nix-develop ./tools/ci/setup-git.sh + - name: Test run: | - source tools/ci/before-script.sh && just nix-develop just test package: @@ -116,15 +127,13 @@ jobs: with: fetch-depth: 0 - - name: Build derivation with nix + - name: Setup Git run: | - source tools/ci/before-script.sh && - just nix-package + just nix-develop ./tools/ci/setup-git.sh - - name: Build the image with nix + - name: Build derivation with nix run: | - source tools/ci/before-script.sh && - just nix-package + just nix-develop just nix-package deploy: runs-on: ubuntu-latest @@ -140,22 +149,22 @@ jobs: with: fetch-depth: 0 + - name: Setup Git + run: | + just nix-develop ./tools/ci/setup-git.sh + - name: Create version tag (if release) run: | - source tools/ci/before-script.sh && - ./tools/ci/assert-tag.sh "$GITHUB_REF" + just nix-develop ./tools/ci/assert-tag.sh "$GITHUB_REF" - name: Build container image (nix) run: | - source tools/ci/before-script.sh && - just nix-image + just nix-develop just nix-image - name: Push image (if release) run: | - source tools/ci/before-script.sh && - tools/ci/upload-image.sh + just nix-develop tools/ci/upload-image.sh - name: Push tag (if release) run: | - source tools/ci/before-script.sh && - ./tools/ci/assert-tag.sh --push "$GITHUB_REF" + just nix-develop ./tools/ci/assert-tag.sh --push "$GITHUB_REF" diff --git a/README.md b/README.md index 1fdec2f..54792d7 100644 --- a/README.md +++ b/README.md @@ -360,3 +360,6 @@ It will: - Push a prepare tag `prepare-v` which triggers the [`release.yaml`](.github/workflows/release.yaml) pipeline. + +**Note: If the release pipeline fails, you can just run this same command again. +Also rerun it when you made a mistake, it will cancel the current release.** diff --git a/tools/ci/before-script.sh b/tools/ci/setup-git.sh similarity index 78% rename from tools/ci/before-script.sh rename to tools/ci/setup-git.sh index 5d2b1ea..20f1f85 100755 --- a/tools/ci/before-script.sh +++ b/tools/ci/setup-git.sh @@ -11,9 +11,4 @@ git config --global safe.directory "*" || { ROOT_DIR=$(git rev-parse --show-toplevel) . "$ROOT_DIR/tools/general.sh" -print_info "Current dir: '$(pwd)'" -print_info "Running as user: $(id)" - ci_setup_git - -unset ROOT_DIR