Skip to content

Commit 1f732d4

Browse files
authored
fix: deploy after release (#390)
2 parents 8f3dce2 + 872727d commit 1f732d4

File tree

3 files changed

+19
-43
lines changed

3 files changed

+19
-43
lines changed

.github/workflows/deploy.yml

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: Deploy
22
on:
3-
push:
4-
tags:
5-
- "v[0-9]+.[0-9]+.[0-9]+"
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: 'Tag name used to deploy the version'
7+
required: true
8+
type: string
69

710
env:
811
BIN_NAME: cotp
@@ -73,7 +76,7 @@ jobs:
7376
7477
- uses: actions/[email protected]
7578
with:
76-
name: bins-${{ matrix.build }}
79+
name: cotp-${{ matrix.build }}-${{ inputs.tag }}
7780
path: dist
7881

7982
publish:
@@ -87,32 +90,21 @@ jobs:
8790
submodules: false
8891

8992
- uses: actions/download-artifact@v4
90-
# with:
91-
# path: dist
92-
# - run: ls -al ./dist
93-
- run: ls -al bins-*
94-
95-
- name: Calculate tag name
96-
run: |
97-
name=dev
98-
if [[ $GITHUB_REF == refs/tags/v* ]]; then
99-
name=${GITHUB_REF:10}
100-
fi
101-
echo val=$name >> $GITHUB_OUTPUT
102-
echo TAG=$name >> $GITHUB_ENV
103-
id: tagname
93+
- run: ls -al cotp-*
10494

10595
- name: Build archive
10696
shell: bash
97+
env:
98+
TAG: ${{ inputs.tag }}
10799
run: |
108100
set -ex
109101
110102
rm -rf tmp
111103
mkdir tmp
112104
mkdir dist
113105
114-
for dir in bins-* ; do
115-
platform=${dir#"bins-"}
106+
for dir in cotp-* ; do
107+
platform=${dir#"cotp-"}
116108
unset exe
117109
# If platform contains "win" then append .exe to the filename
118110
if [[ "$platform" == *"win"* ]]; then
@@ -137,14 +129,9 @@ jobs:
137129
repo_token: ${{ secrets.GITHUB_TOKEN }}
138130
file: dist/*
139131
file_glob: true
140-
tag: ${{ steps.tagname.outputs.val }}
132+
tag: ${{ inputs.tag }}
141133
overwrite: true
142134

143-
- name: Extract version
144-
id: extract-version
145-
run: |
146-
printf "%s=%s >> $GITHUB_OUTPUT\n" tag-name "${GITHUB_REF#refs/tags/}"
147-
148135
publish_on_cargo_crates:
149136
name: "Publish crate on crates.io"
150137
needs: [dist]
@@ -177,22 +164,10 @@ jobs:
177164
with:
178165
submodules: true
179166

180-
- name: Calculate tag name
181-
run: |
182-
name=dev
183-
if [[ $GITHUB_REF == refs/tags/v* ]]; then
184-
name=${GITHUB_REF:10}
185-
fi
186-
echo val=$name >> $GITHUB_OUTPUT
187-
echo TAG=$name >> $GITHUB_ENV
188-
id: tagname
189-
190167
- name: Generate PKGBUILDs
191168
shell: bash
192169
run: |
193-
# requests is already installed
194-
# pip install requests
195-
python ci/build_pkgbuild.py ${{env.TAG}}
170+
python ci/build_pkgbuild.py ${{ inputs.tag }}
196171
cat ./ci/cotp/PKGBUILD
197172
cat ./ci/cotp-bin/PKGBUILD
198173
@@ -204,7 +179,7 @@ jobs:
204179
commit_username: ${{ secrets.AUR_USERNAME }}
205180
commit_email: ${{ secrets.AUR_EMAIL }}
206181
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
207-
commit_message: Update cotp package to version ${{env.TAG}}
182+
commit_message: Update cotp package to version ${{ inputs.tag }}
208183
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519
209184

210185
- name: "Clean repo dir"
@@ -220,5 +195,5 @@ jobs:
220195
commit_username: ${{ secrets.AUR_USERNAME }}
221196
commit_email: ${{ secrets.AUR_EMAIL }}
222197
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
223-
commit_message: Update cotp-bin package to version ${{env.TAG}}
198+
commit_message: Update cotp-bin package to version ${{ inputs.tag }}
224199
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install Semantic Release globally
2525
run: npm install -g semantic-release @semantic-release/git @semantic-release/exec
2626

27-
- name: Run the release
27+
- name: Release with semantic versioning
2828
run: npx semantic-release
2929
env:
3030
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.releaserc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[
77
"@semantic-release/exec",
88
{
9-
"prepareCmd": "ci/write_cargo_version.sh ${nextRelease.version}"
9+
"prepareCmd": "ci/write_cargo_version.sh ${nextRelease.version}",
10+
"successCmd": "gh workflow run Deploy -f tag=${nextRelease.version}"
1011
}
1112
],
1213
[

0 commit comments

Comments
 (0)