Release package #76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release package | |
on: | |
workflow_dispatch: | |
inputs: | |
release-type: | |
description: 'Release type (one of): patch, minor, major, prepatch, preminor, premajor, prerelease' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
release-package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# see also https://github.com/Nautilus-Cyberneering/pygithub | |
- name: Import GPG key | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: GPG user IDs | |
run: | | |
echo "fingerprint: ${{ steps.import-gpg.outputs.fingerprint }}" | |
echo "keyid: ${{ steps.import-gpg.outputs.keyid }}" | |
echo "name: ${{ steps.import-gpg.outputs.name }}" | |
echo "email: ${{ steps.import-gpg.outputs.email }}" | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: https://registry.npmjs.org/ | |
node-version: '20' | |
- name: Git configuration | |
run: | | |
git config --global user.email "${{ steps.import-gpg.outputs.email }}" | |
git config --global user.name "${{ steps.import-gpg.outputs.name }}" | |
- name: Bump release version | |
if: startsWith(github.event.inputs.release-type, 'pre') != true | |
run: | | |
echo "NEW_VERSION=$(npm --no-git-tag-version --tag-version-prefix= version $RELEASE_TYPE)" >> $GITHUB_ENV | |
echo "RELEASE_TAG=latest" >> $GITHUB_ENV | |
env: | |
RELEASE_TYPE: ${{ github.event.inputs.release-type }} | |
- name: Bump pre-release version | |
if: startsWith(github.event.inputs.release-type, 'pre') | |
run: | | |
echo "NEW_VERSION=$(npm --no-git-tag-version --tag-version-prefix= --preid=beta version $RELEASE_TYPE | |
echo "RELEASE_TAG=beta" >> $GITHUB_ENV | |
env: | |
RELEASE_TYPE: ${{ github.event.inputs.release-type }} | |
- name: Update changelog | |
uses: superfaceai/release-changelog-action@v3 | |
with: | |
path-to-changelog: CHANGELOG.md | |
version: ${{ env.NEW_VERSION }} | |
operation: release | |
- name: Commit CHANGELOG.md and package.json changes and create tag | |
run: | | |
git add "package.json" | |
git add "CHANGELOG.md" | |
git commit -m "chore: release ${{ env.NEW_VERSION }}" | |
git tag ${{ env.NEW_VERSION }} | |
- name: Build | |
run: | | |
yarn install --dev | |
yarn build | |
- name: Publish | |
run: yarn publish --verbose --access public --tag ${{ env.RELEASE_TAG }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create local package | |
run: | | |
yarn pack --filename "ember-nexus-web-sdk-${{ env.NEW_VERSION }}.tar.gz" | |
ls -lah | |
pwd | |
- name: Push changes to repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push origin && git push --tags | |
- id: get-changelog | |
name: Get version changelog | |
uses: superfaceai/release-changelog-action@v3 | |
with: | |
path-to-changelog: CHANGELOG.md | |
version: ${{ env.NEW_VERSION }} | |
operation: read | |
- name: Update GitHub release documentation | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.NEW_VERSION }} | |
body: ${{ steps.get-changelog.outputs.changelog }} | |
prerelease: ${{ startsWith(github.event.inputs.release-type, 'pre') }} | |
token: ${{ secrets.RELEASE_TOKEN }} | |
files: ember-nexus-web-sdk-${{ env.NEW_VERSION }}.tar.gz | |
- name: Initiate Originstamp certificate | |
run: | | |
curl -X POST "http://api.originstamp.com/v4/timestamp/create" \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: ${{ secrets.ORIGINSTAMP_AUTH_TOKEN }}" \ | |
-d \ | |
"{ | |
\"comment\": \"Release ${{ env.NEW_VERSION }} of ember-nexus/web-sdk\", | |
\"hash\": \"${{ env.SHA }}\" | |
}" | |
env: | |
SHA: ${{ github.sha }} | |
- uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
NEW_VERSION: ${{ env.NEW_VERSION }} | |
with: | |
filename: .github/ISSUE_TEMPLATE_POST_RELEASE_TASK.md |