diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 00000000..d56831fd --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,45 @@ +name: prerelease +on: + push: + branches: + # releases// + - releases/*/* +jobs: + prerelease: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: "*" + cache: "npm" + check-latest: true + registry-url: "https://registry.npmjs.org" + - name: Install core dependencies + run: npm ci --no-audit + - name: Extract tag and version + id: extract + run: |- + ref=${{ github.ref }} + branch=${ref:11} + tag_version=${branch:9} + tag=${tag_version%/*} + version=${tag_version##*/} + echo "::set-output name=tag::${tag}" + echo "::set-output name=version::${version}" + - name: Log versions + run: |- + echo tag=${{ steps.extract.outputs.tag }} + echo version=${{ steps.extract.outputs.version }} + - name: Setup git user + run: git config --global user.name github-actions + - name: Setup git email + run: git config --global user.email github-actions@github.com + - name: Run npm version + run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }} --allow-same-version + - name: Push changes + run: git push --follow-tags + - name: Run npm publish + run: npm publish --tag=${{ steps.extract.outputs.tag }} + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..cb118778 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,33 @@ +name: release-please +on: + push: + branches: + - main +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: navikt/github-app-token-generator@a9cd374e271b8aef573b8c16ac46c44fb89b02db + id: get-token + with: + private-key: ${{ secrets.TOKENS_PRIVATE_KEY }} + app-id: ${{ secrets.TOKENS_APP_ID }} + - uses: GoogleCloudPlatform/release-please-action@v2 + id: release + with: + token: ${{ steps.get-token.outputs.token }} + release-type: node + package-name: "gatsby-plugin-netlify" + - uses: actions/checkout@v2 + if: ${{ steps.release.outputs.release_created }} + - uses: actions/setup-node@v2 + with: + node-version: "*" + cache: "npm" + check-latest: true + registry-url: "https://registry.npmjs.org" + if: ${{ steps.release.outputs.release_created }} + - run: npm publish + if: ${{ steps.release.outputs.release_created }} + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}