-
Notifications
You must be signed in to change notification settings - Fork 8
126 lines (113 loc) · 3.68 KB
/
release.yaml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: release
on:
workflow_dispatch:
inputs:
commit:
description: "commit SHA to make release from"
required: true
default: main
version:
description: "release version, also creates a tag e.g. (0.1.0)"
required: true
permissions:
actions: read
checks: none
contents: write
deployments: none
issues: none
packages: write
pull-requests: none
repository-projects: none
security-events: none
statuses: none
jobs:
release:
strategy:
matrix:
os: ["ubuntu-22.04", "depot-ubuntu-22.04-arm"]
include:
- os: ubuntu-22.04
arch: linux/amd64
sha: cfce811006a27305071b1634ca8fe690392f5dcc205612e7b4e5bde411b7701e
arch-suffix: amd64
- os: depot-ubuntu-22.04-arm
arch: linux/arm64
sha: 4b475e7e7eed79708b2707a67d556a5d3c0bdaef0a1f341311d095d1b4b3e271
arch-suffix: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.inputs.commit }}
- name: Validate version
run: ./scripts/semver.sh ${{ github.event.inputs.version }}
- uses: actions/setup-go@v3
with:
go-version: "~1.22"
- name: Go Cache Paths
id: go-cache-paths
run: |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }}
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
- name: Setup Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Coder CI"
- name: Build Image
run: make -j ARCH=${{ matrix.arch }} SYSBOX_SHA=${{ matrix.sha }} build/image/envbox
- name: Tag Image
run: docker tag envbox ghcr.io/coder/envbox:${{ github.event.inputs.version }}-${{ matrix.arch-suffix }}
- name: Push Image
run: docker push ghcr.io/coder/envbox:${{ github.event.inputs.version }}-${{ matrix.arch-suffix }}
manifest:
runs-on: ubuntu-22.04
needs: release
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.inputs.commit }}
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Manifest
run: |
docker manifest create ghcr.io/coder/envbox:${{ github.event.inputs.version }} \
--amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-amd64 \
--amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-arm64
- name: Push Manifest
run: |
docker manifest push ghcr.io/coder/envbox:${{ github.event.inputs.version }}
tag:
runs-on: ubuntu-22.04
needs: manifest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.inputs.commit }}
- name: Setup Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Coder CI"
- name: Tag and Push Commit
run: |
git tag -a ${{ github.event.inputs.version }} -m ${{ github.event.inputs.version }}
git push --tags