-
Notifications
You must be signed in to change notification settings - Fork 21
73 lines (61 loc) · 1.67 KB
/
cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: CI/CD
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.20
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run test
run: make test
- name: Test Docker build
run: docker build --rm -t ghcr.io/scribd/objinsync:latest .
release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: test
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: scribdbot
password: ${{ secrets.SCRIBDBOT_GH_CONTAINER_REGISTRY_TOKEN }}
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# required for the changelog to work correctly
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.20
id: go
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# FIXME: SCRIBDBOT_GH_CONTAINER_REGISTRY_TOKEN doesn't have write access to publish package
# - name: Build and publish docker image
# run: |
# VERSION=${GITHUB_REF##*/}
# docker build --rm -t "ghcr.io/scribd/objinsync:${VERSION}" .
# docker push "ghcr.io/scribd/objinsync:${VERSION}"