Skip to content

Commit

Permalink
ci: add/update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wetransformer committed Apr 12, 2024
1 parent a04a1f4 commit d140562
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/tf-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#
# PLEASE NOTE: Managed workflow - do not change manually
#
name: Release

on:
workflow_dispatch: {}

concurrency:
# only run one publishing at a time to avoid conflicts
group: publish-${{ github.ref }}

env:
# renovate: datasource=npm depName=@semantic-release/changelog
SEMANTIC_RELEASE_CHANGELOG_VERSION: 6.0.3

# renovate: datasource=npm depName=@semantic-release/git
SEMANTIC_RELEASE_GIT_VERSION: 10.0.1

# renovate: datasource=npm depName=conventional-changelog-conventionalcommits
CONVENTIONAL_CHANGELOG_CONVENTIONALCOMMITS_VERSION: 7.0.2

jobs:
release:
name: Release
runs-on: ubuntu-latest

outputs:
release-published: ${{ steps.release.outputs.new_release_published }}
release-version: ${{ steps.release.outputs.new_release_version }}

steps:
- name: Determine app token for release
uses: actions/create-github-app-token@7bfa3a4717ef143a604ee0a99d859b8886a96d00 # v1.9.3
id: app-token
with:
app-id: ${{ secrets.WE_RELEASE_GITHUB_APP_ID }}
private-key: ${{ secrets.WE_RELEASE_GITHUB_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ steps.app-token.outputs.token }}
# Note: special permissions for push to protected branch required
# Credentials required for semantic-release-github-actions-tags
# persist-credentials: false

- name: Create release configuration file
if: ${{ hashFiles('.releaserc.yml') == '' }}
shell: bash
# TODO rather use a template?
run: |
cat <<EOF > .releaserc.yml
---
branches: ${{ github.head_ref || github.ref_name }}
plugins:
- - "@semantic-release/commit-analyzer"
# see https://github.com/semantic-release/commit-analyzer?tab=readme-ov-file#options
- preset: conventionalcommits
- - "@semantic-release/release-notes-generator"
# see https://github.com/semantic-release/release-notes-generator?tab=readme-ov-file#options
- preset: conventionalcommits
presetConfig:
issuePrefixes: ['ING-', 'WGS-', 'SVC-']
issueUrlFormat: 'https://wetransform.atlassian.net/browse/{{prefix}}{{id}}'
parserOpts:
# https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#referenceactions
# set to null to reference an issue without action (but will still show it "closes" the issue in the changelog)
# referenceActions: null
- "@semantic-release/changelog"
- - "@semantic-release/git"
- assets:
- CHANGELOG.md
- "@semantic-release/github"
- 'semantic-release-github-actions-tags'
EOF
- name: Install NodeJs
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20

- name: Release
id: release
uses: cycjimmy/semantic-release-action@cb425203a562475bca039ba4dbf90c7f9ac790f4 # v4.1.0
env:
# Permissions needed
# contents: write
# issues: write
# pull-requests: write
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GIT_AUTHOR_NAME: wetransform Bot
GIT_AUTHOR_EMAIL: 113353961+wetransformer@users.noreply.github.com
GIT_COMMITTER_NAME: wetransform Bot
GIT_COMMITTER_EMAIL: 113353961+wetransformer@users.noreply.github.com
RUNNER_DEBUG: 1
with:
# dry_run: true
semantic_version: 23.0.7

extra_plugins:
"@semantic-release/changelog@\
${{ env.SEMANTIC_RELEASE_CHANGELOG_VERSION }} \
@semantic-release/git@\
${{ env.SEMANTIC_RELEASE_GIT_VERSION }} \
conventional-changelog-conventionalcommits@\
${{ env.CONVENTIONAL_CHANGELOG_CONVENTIONALCOMMITS_VERSION }} \
semantic-release-github-actions-tags@\
"

0 comments on commit d140562

Please sign in to comment.