File tree 2 files changed +68
-0
lines changed
2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : release
2
+ on :
3
+ push :
4
+ tags :
5
+ - " v*"
6
+
7
+ permissions :
8
+ # Required to publish a release
9
+ contents : write
10
+ # Necessary to push docker images to ghcr.io.
11
+ packages : write
12
+ # Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
13
+ id-token : write
14
+
15
+ concurrency : ${{ github.workflow }}-${{ github.ref }}
16
+
17
+ jobs :
18
+ release :
19
+ name : Build and publish
20
+ runs-on : ubuntu-latest
21
+ steps :
22
+ - uses : actions/checkout@v3
23
+
24
+ - name : Echo Go Cache Paths
25
+ id : go-cache-paths
26
+ run : |
27
+ echo "GOCACHE=$(go env GOCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
28
+ echo "GOMODCACHE=$(go env GOMODCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
29
+
30
+ - name : Go Build Cache
31
+ uses : actions/cache@v3
32
+ with :
33
+ path : ${{ steps.go-cache-paths.outputs.GOCACHE }}
34
+ key : ${{ runner.os }}-go-build-${{ hashFiles('**/go.**', '**.go') }}
35
+
36
+ - uses : actions/setup-go@v3
37
+ with :
38
+ go-version : " ~1.20"
39
+
40
+ - name : Build
41
+ run : ./scripts/build.sh
42
+
43
+ - name : Docker Login
44
+ uses : docker/login-action@v2
45
+ with :
46
+ registry : ghcr.io
47
+ username : ${{ github.actor }}
48
+ password : ${{ secrets.GITHUB_TOKEN }}
49
+
50
+ - name : Push Image
51
+ run : |
52
+ VERSION=$(./scripts/version.sh)
53
+ BASE=ghcr.io/coder/coder-logstream-kube
54
+ IMAGE=$BASE:$VERSION
55
+ docker tag coder-logstream-kube:latest $IMAGE
56
+ docker tag coder-logstream-kube:latest $BASE:latest
57
+ docker push $IMAGE
58
+ docker push $BASE:latest
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ cd $( dirname " ${BASH_SOURCE[0]} " )
5
+
6
+ last_tag=" $( git describe --tags --abbrev=0) "
7
+ version=" $last_tag "
8
+
9
+ # Remove the "v" prefix.
10
+ echo " ${version# v} "
You can’t perform that action at this time.
0 commit comments