Skip to content

Commit

Permalink
Update release strategy (#644)
Browse files Browse the repository at this point in the history
* update workflow to have run release independently
  • Loading branch information
Sandra Viktoria D. Toftemo authored May 2, 2023
1 parent 1007502 commit eff7ae8
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 239 deletions.
47 changes: 29 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Release

on:
push:
branches:
- main
release:
types: [published]

permissions:
contents: write

jobs:
release:
Expand All @@ -15,24 +18,32 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
cache: yarn

- name: Installing dependencies 📦️
run: yarn install
- name: Install dependencies 📦️
run: yarn install --frozen-lockfile

- name: Building 🔨
run: yarn run build
- name: Build 🔨
run: yarn build

- name: Release? 🤔
uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: '@swedbank-pay/sdk'
- name: Get version from git tag 🏷️
id: version
uses: jannemattila/get-version-from-tag@v1

- name: Releasing 🚀
if: ${{ steps.release.outputs.release_created }}
run: yarn npm publish
- name: Set version to release tag 📝
run:
yarn version --no-commit-hooks --no-git-tag-version --new-version ${{
steps.version.outputs.version }}

- name: Publish 🚀
run: yarn publish
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push version changes to main branch
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: release ${{ github.event.release.tag_name }}'
branch: main
file_pattern: package.json
16 changes: 16 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,19 @@ jobs:

- name: Sending reports to Codecov 📝
uses: codecov/codecov-action@v3
release-please:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v3

- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
release-type: node
package-name: create-bjerk-typescript
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"eslint-plugin-jest": "~27.1.4",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-unicorn": "44.0.2",
"eslint-plugin-unicorn": "^43.0.2",
"jest": "~29.3.1",
"nock": "^13.2.9",
"prettier": "~2.7.1",
Expand Down
Loading

0 comments on commit eff7ae8

Please sign in to comment.