Skip to content

Commit 3660169

Browse files
committed
Add a release script
1 parent c6457aa commit 3660169

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/actions/release.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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

scripts/version.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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}"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy