Skip to content

Commit 2f4b7cd

Browse files
committed
ci: create a "latest" release synced with master
1 parent 569b107 commit 2f4b7cd

File tree

4 files changed

+24
-29
lines changed

4 files changed

+24
-29
lines changed

.github/actions/build/action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ runs:
1414
run: |
1515
mkdir build
1616
$buildDir = Join-Path . build
17-
$commandDir = Join-Path . cmd fs
18-
go build -o ${buildDir} ${commandDir}
17+
$buildCommand = Join-Path . cmd build
18+
go run $buildCommand -o $buildDir

.github/actions/latest/action.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Latest"
2+
description: 'Update the GitHub release tagged "latest"'
3+
inputs:
4+
github-token:
5+
description: "Token used to publish releases"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- shell: bash
11+
env:
12+
GH_TOKEN: ${{ inputs.github-token }}
13+
run: |
14+
git tag --force latest master
15+
git push --force origin latest
16+
pushd artifact
17+
gh release upload --clobber latest *
18+
popd

.github/actions/prerelease/action.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/action.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ on:
33
push:
44
branches:
55
- master
6-
tags:
7-
- 'prerelease'
8-
- 'release'
96
pull_request:
107
jobs:
118
Test:
@@ -18,7 +15,7 @@ jobs:
1815
- uses: ./.github/actions/setup
1916
- uses: ./.github/actions/test
2017
Build:
21-
if: github.ref == 'refs/tags/prerelease' || github.ref == 'refs/tags/release'
18+
if: github.ref == 'refs/heads/master'
2219
strategy:
2320
matrix:
2421
os: [windows-latest, macos-latest, ubuntu-latest]
@@ -28,13 +25,13 @@ jobs:
2825
- uses: ./.github/actions/setup
2926
- uses: ./.github/actions/build
3027
- uses: ./.github/actions/archive
31-
Prerelease:
32-
if: github.ref == 'refs/tags/prerelease' # TODO: invert this? If prerelease; setup + test + build + release
28+
Release:
29+
if: github.ref == 'refs/heads/master'
3330
needs: [Test, Build]
3431
runs-on: ubuntu-latest
3532
steps:
3633
- uses: actions/checkout@v3
3734
- uses: actions/download-artifact@v3
38-
- uses: ./.github/actions/prerelease
35+
- uses: ./.github/actions/latest
3936
with:
4037
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)