Skip to content

Commit 64a63c0

Browse files
added release workflow
ISSUE: CLDSRVCLT-7
1 parent dbfab6d commit 64a63c0

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Setup Smithy CLI'
2+
description: 'Install Smithy CLI for building the project'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Install Smithy CLI
8+
shell: bash
9+
env:
10+
SMITHY_VERSION: '1.61.0'
11+
run: |
12+
mkdir -p smithy-install/smithy
13+
curl -L https://github.com/smithy-lang/smithy/releases/download/${SMITHY_VERSION}/smithy-cli-linux-x86_64.zip -o smithy-install/smithy-cli-linux-x86_64.zip
14+
unzip -qo smithy-install/smithy-cli-linux-x86_64.zip -d smithy-install
15+
mv smithy-install/smithy-cli-linux-x86_64/* smithy-install/smithy
16+
sudo smithy-install/smithy/install
17+
smithy --version

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: release
3+
run-name: release ${{ inputs.tag }}
4+
5+
on:
6+
# push:
7+
# branches:
8+
# - improvement/CLDSRVCLT-X
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: 'Tag to be released (e.g., 1.0.0)'
13+
required: true
14+
15+
jobs:
16+
build-and-tag:
17+
name: Build and tag
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
cache: 'yarn'
31+
32+
- name: Install dependencies
33+
run: yarn install --frozen-lockfile
34+
35+
- name: Setup Smithy CLI
36+
uses: ./.github/actions/setup-smithy
37+
38+
- name: Build project
39+
run: yarn build
40+
41+
- name: Create Tag with Build Artifacts
42+
run: |
43+
# Configure git user to the GitHub Actions bot
44+
git config --global user.name "github-actions[bot]"
45+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
46+
47+
# Force add the build folders (even if they are in .gitignore)
48+
git add -f dist build
49+
50+
# Determine tag name
51+
TAG_NAME="${{ inputs.tag }}"
52+
if [ -z "$TAG_NAME" ]; then
53+
TAG_NAME="test-${{ github.sha }}"
54+
fi
55+
56+
# Commit the build artifacts
57+
git commit -m "Build artifacts for version $TAG_NAME"
58+
59+
# Create the tag
60+
git tag $TAG_NAME
61+
62+
# Push the tag to the repository
63+
git push origin $TAG_NAME
64+
65+
# Export tag name for next step
66+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
67+
id: create_tag
68+
69+
- name: Create GitHub Release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
tag_name: ${{ steps.create_tag.outputs.tag_name }}
73+
name: Release ${{ steps.create_tag.outputs.tag_name }}
74+
draft: false
75+
prerelease: false
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ jobs:
2727
- name: Install dependencies
2828
run: yarn install --frozen-lockfile
2929

30+
- name: Setup Smithy CLI
31+
uses: ./.github/actions/setup-smithy
32+
33+
- name: Build
34+
run: yarn build
35+
3036
- name: TypeScript typecheck
3137
run: yarn typecheck
3238

@@ -51,6 +57,12 @@ jobs:
5157
- name: Install dependencies
5258
run: yarn install --frozen-lockfile
5359

60+
- name: Setup Smithy CLI
61+
uses: ./.github/actions/setup-smithy
62+
63+
- name: Build
64+
run: yarn build
65+
5466
- name: Start Cloudserver with MongoDB backend
5567
run: docker compose -f .github/docker-compose.cloudserver-mongo.yml up -d
5668

@@ -84,6 +96,12 @@ jobs:
8496
- name: Install dependencies
8597
run: yarn install --frozen-lockfile
8698

99+
- name: Setup Smithy CLI
100+
uses: ./.github/actions/setup-smithy
101+
102+
- name: Build
103+
run: yarn build
104+
87105
- name: Login to GitHub Container Registry
88106
uses: docker/login-action@v3
89107
with:

0 commit comments

Comments
 (0)