Skip to content

Commit 3023535

Browse files
authored
Merge pull request #311 from oasisprotocol/mz/releaseWorkflow
Add release GitHub workflow
2 parents 70e9851 + dee6cc0 commit 3023535

4 files changed

Lines changed: 70 additions & 2 deletions

File tree

.changelog/311.process.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add release GitHub workflow

.github/workflows/ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ jobs:
4141
uses: actions/upload-artifact@v4
4242
with:
4343
name: oasis-rofl-app-${{ steps.vars.outputs.SHORT_SHA }}
44-
path: build
44+
path: dist

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
2+
name: release
3+
4+
# Trigger the workflow when:
5+
on:
6+
# A push occurs to one of the matched tags.
7+
push:
8+
tags:
9+
# Pattern that roughly matches Oasis Core's version tags.
10+
# For more details on GitHub Actions' pattern match syntax, see:
11+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#patterns-to-match-branches-and-tags.
12+
- 'v[0-9]+.[0-9]+*'
13+
14+
jobs:
15+
release:
16+
# NOTE: This name appears in GitHub's Checks API.
17+
name: prepare-release
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: true
26+
- name: Set up Node.js 20
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20.x'
30+
cache: yarn
31+
- name: Install dependencies
32+
run: yarn install --frozen-lockfile
33+
- name: Build app
34+
run: yarn build
35+
- name: Set workflow variables
36+
# Id is needed to access output in a next step.
37+
id: vars
38+
env:
39+
# There's no support for escaping this for use in a shell command.
40+
# GitHub's recommendation is to pass it through the environment.
41+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
42+
REF_NAME: ${{ github.ref_name }}
43+
# We want to show version without the leading 'v'
44+
# and use short SHA of the commit for file name.
45+
run: |
46+
echo "VERSION=$(echo "$REF_NAME" | sed 's/^v//')" >> "$GITHUB_OUTPUT"
47+
- name: Create zip file
48+
env:
49+
# Need to escape again
50+
VERSION: ${{ steps.vars.outputs.VERSION }}
51+
run: |
52+
cd dist/
53+
zip -r "../rofl-app-$VERSION.zip" .
54+
- name: Parse CHANGELOG.md file and extract changes for the given version
55+
uses: buberdds/extract-changelog-action@v1
56+
id: changelog
57+
with:
58+
version: ${{ steps.vars.outputs.VERSION }}
59+
- name: Release
60+
uses: softprops/action-gh-release@v2
61+
with:
62+
files: |
63+
rofl-app-${{ steps.vars.outputs.VERSION }}.zip
64+
name: ROFL App ${{ steps.vars.outputs.VERSION }}
65+
body: ${{ steps.changelog.outputs.content }}
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

towncrier.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ check_ignore_files = [
1010
# File where we store app version.
1111
"package.json",
1212
]
13-
issue_format = "[#{issue}](https://github.com/oasisprotocol/rose-app/issues/{issue})"
13+
issue_format = "[#{issue}](https://github.com/oasisprotocol/rofl-app/issues/{issue})"
1414
start_string = "<!-- TOWNCRIER -->\n"
1515
# Custom Jinja2 template for preparing a new section of the Change Log.
1616
template = ".changelog/template.md.j2"

0 commit comments

Comments
 (0)