diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a210ef..f11354b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,21 @@ name: Test and Release on: + workflow_dispatch: push: branches: [main] + paths-ignore: + - "**.md" + - "**/release.yml" + - "static/**" + - "docs/**" pull_request: branches: [main] - release: - types: [published] + +permissions: + id-token: write + contents: write + packages: write jobs: test: @@ -24,16 +33,34 @@ jobs: release: needs: test runs-on: ubuntu-latest - if: github.event_name == 'release' + if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Calculate version + id: version + uses: lukaszraczylo/shared-actions/.github/actions/semver@main + with: + config-file: semver.yaml + + - name: Create tag + if: steps.version.outputs.version_tag != '' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag ${{ steps.version.outputs.version_tag }} + git push origin ${{ steps.version.outputs.version_tag }} + - uses: actions/setup-node@v4 + if: steps.version.outputs.version_tag != '' with: node-version: '20' registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npm run build + - name: Run GoReleaser + if: steps.version.outputs.version_tag != '' uses: goreleaser/goreleaser-action@v6 with: version: latest diff --git a/semver.yaml b/semver.yaml new file mode 100644 index 0000000..be80efe --- /dev/null +++ b/semver.yaml @@ -0,0 +1,15 @@ +version: 1 +force: + existing: true + strict: false + minor: 1 +wording: + patch: + - update + - initial + - fix + minor: + - improve + - release + major: + - breaking