From c3bf9384e1999321b6a00a04f16e1d11bb35ea53 Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Sat, 30 Jul 2022 13:31:06 +0000 Subject: [PATCH] ci: introduce actionlint and semantic-tags (#537) close #466 --- .github/workflows/semantic-tag.yml | 45 ++++++++++++++++++++++++++++++ .github/workflows/test.yml | 14 ++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .github/workflows/semantic-tag.yml diff --git a/.github/workflows/semantic-tag.yml b/.github/workflows/semantic-tag.yml new file mode 100644 index 0000000..50e8240 --- /dev/null +++ b/.github/workflows/semantic-tag.yml @@ -0,0 +1,45 @@ +name: Publish semantic tags + +on: + release: + types: + - published + +permissions: + contents: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + # Release with semantic tag like v1.0.3 + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.release.tag_name }} + token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - run: npm install semver + - name: Get versions + uses: actions/github-script@v6 + id: batch + env: + TAG_NAME: ${{ github.event.release.tag_name }} + with: + script: | + const semver = require('semver') + const { TAG_NAME } = process.env + return { + minor: `v${semver.major(TAG_NAME).toString()}.${semver.minor(TAG_NAME).toString()}`, + major: `v${semver.major(TAG_NAME).toString()}` + } + - run: | + git tag -f "$MAJOR_VER" + git tag -f "$MINOR_VER" + git push origin -f "$MAJOR_VER" + git push origin -f "$MINOR_VER" + env: + MAJOR_VER: ${{ fromJSON(steps.batch.outputs.result).major }} + MINOR_VER: ${{ fromJSON(steps.batch.outputs.result).minor }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81a4cfe..d84ce32 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,3 +40,17 @@ jobs: - uses: ./ with: version: 'v2.4.1' + actionlint: + runs-on: ubuntu-latest + if: github.event.pull_request + permissions: + contents: read + checks: write + pull-requests: write + steps: + - uses: actions/checkout@v3 + - uses: reviewdog/action-actionlint@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + reporter: github-pr-review