Skip to content

Commit 6e14ed0

Browse files
fix(ci): create dirty tag releases (#4)
goreleaser really wants to operate on tags; after successful test/build, create release; run goreleaser on creation of git tag
1 parent 3422ae6 commit 6e14ed0

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,28 @@ jobs:
8282

8383
- run: make bootstrap
8484
- run: make check
85+
86+
push_dirty_tag:
87+
runs-on: ubuntu-latest
88+
needs: [qa, test, build]
89+
steps:
90+
-
91+
name: Get tag
92+
id: get_tag
93+
run: |
94+
git remote add upstream https://github.com/peak/s5cmd.git
95+
git fetch --tags upstream
96+
VERSION=$(git describe --tags --exclude '*-' --abbrev=0)
97+
echo "VERSION=$VERSION" >> $GITHUB_ENV
98+
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
99+
echo "version=$VERSION" >> $GITHUB_OUTPUT
100+
echo "short_sha=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT
101+
102+
-
103+
name: Push dirty tag
104+
id: push_dirty_tag
105+
run: |
106+
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
107+
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
108+
git tag -a "${{ steps.get_tag.outputs.version }}-${{ steps.get_tag.outputs.short_sha }}" -m "Release ${{ steps.get_tag.outputs.version }}-${{ steps.get_tag.outputs.short_sha }}"
109+
git push origin "${{ steps.get_tag.outputs.version }}-${{ steps.get_tag.outputs.short_sha }}"

.github/workflows/docker.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: docker
22
on:
3-
workflow_dispatch: {}
4-
push:
5-
branches:
6-
- "coreweave"
3+
release:
4+
types: [published]
75
jobs:
86
multi:
97
runs-on: ubuntu-latest

.github/workflows/goreleaser.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: goreleaser
22
on:
3-
workflow_dispatch: {}
4-
push:
5-
branches:
6-
- "coreweave"
3+
release:
4+
types: [published]
75
jobs:
86
caios_test:
97
name: caios-test
@@ -40,17 +38,6 @@ jobs:
4038
with:
4139
go-version: '1.22'
4240

43-
- name: Get tag
44-
id: get_tag
45-
run: |
46-
git remote add upstream https://github.com/peak/s5cmd.git
47-
git fetch --tags upstream
48-
VERSION=$(git describe --tags --exclude '*-' --abbrev=0)
49-
echo "VERSION=$VERSION" >> $GITHUB_ENV
50-
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
51-
echo "version=$VERSION" >> $GITHUB_OUTPUT
52-
echo "short_sha=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT
53-
5441
-
5542
name: Run GoReleaser
5643
uses: goreleaser/goreleaser-action@v2
@@ -59,5 +46,5 @@ jobs:
5946
args: release --rm-dist
6047
env:
6148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
GORELEASER_CURRENT_TAG: ${{ steps.get_tag.outputs.version }}-${{ steps.get_tag.outputs.short_sha }}
49+
6350

0 commit comments

Comments
 (0)