From d65e172a048d8e074c3d7c97caa4bc158819e0e7 Mon Sep 17 00:00:00 2001 From: Sascha Lisson Date: Mon, 4 Mar 2024 14:41:16 +0100 Subject: [PATCH] ci: dry run releases --- .github/workflows/dry-run-release.yml | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/dry-run-release.yml diff --git a/.github/workflows/dry-run-release.yml b/.github/workflows/dry-run-release.yml new file mode 100644 index 0000000..6745e3f --- /dev/null +++ b/.github/workflows/dry-run-release.yml @@ -0,0 +1,45 @@ +name: Dry-Run Release +on: + pull_request: + +jobs: + lint-commits: + name: Lint PR commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v5 + + test-release: + name: Dry-run semantic-release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Checkout branch + # Pretend to semantic-release that the PR result is eligible for + # building releases because --dry-run still filters for configured + # branches. + run: git checkout -b main + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Cache Node packages + uses: actions/cache@v4 + with: + path: node_modules + key: release-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }} + - name: Install dependencies + run: npm ci + - name: Dry-run release + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + # We need to convince semantic-release to not pick up some + # configuration from the CI environment by removing the variable that + # is used for CI detection. + run: unset GITHUB_ACTIONS && npx semantic-release --dry-run --ci false