diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index dd4d6b2..7fc6ebb 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -7,8 +7,19 @@ on: - main paths: - "package.json" +permissions: + contents: read + +# Queue runs instead of running them side by side, so a push and a manual +# run right after it can't both release the same version. +concurrency: + group: create-release + cancel-in-progress: false + jobs: build: + permissions: + contents: write runs-on: ubuntu-latest steps: - name: Checkout @@ -31,13 +42,20 @@ jobs: - name: Generate new release version id: newversion run: python tools/release.py -l "${{ steps.changes.outputs.last-tag }}" + # NEW_VERSION stays empty when package.json does not hold the next + # version (any other change to package.json on main). + - name: Stop when there is no new version + if: env.NEW_VERSION == '' + run: echo "package.json does not hold a new version, nothing to release." - name: GitHub Release + if: env.NEW_VERSION != '' uses: softprops/action-gh-release@v3 with: tag_name: "${{ env.NEW_VERSION }}" make_latest: "true" generate_release_notes: true - name: NPM Release (version specific) + if: env.NEW_VERSION != '' uses: JS-DevTools/npm-publish@v4 with: token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e1fcf0c..26b4960 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -6,6 +6,9 @@ on: pull_request: branches: - main +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/manual-start.yml b/.github/workflows/manual-start.yml index 78e9340..499b6ba 100644 --- a/.github/workflows/manual-start.yml +++ b/.github/workflows/manual-start.yml @@ -9,6 +9,9 @@ on: type: string env: TEST_TAG: webperfse/webperf-core:test +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/prep-release.yml b/.github/workflows/prep-release.yml index af5cec4..e7e4b8b 100644 --- a/.github/workflows/prep-release.yml +++ b/.github/workflows/prep-release.yml @@ -7,8 +7,14 @@ on: - main paths: - "index.js" +permissions: + contents: read + jobs: build: + permissions: + contents: write + pull-requests: write runs-on: ubuntu-latest steps: - name: Checkout