-
Notifications
You must be signed in to change notification settings - Fork 96
131 lines (118 loc) · 4.15 KB
/
release-latest.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
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
127
128
129
130
131
name: Juno Latest Build
env:
REGISTRY: ghcr.io
IMAGE_NAME: juno-admin-dev
MYSQL_IMAGE_NAME: mysql-dev
on:
push:
branches:
- master
workflow_dispatch:
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "14"
cache: "yarn"
cache-dependency-path: assets/package-lock.json
- name: yarn build dist
run: |
cd assets
yarn install
yarn build
git checkout -- yarn.lock
- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: 1.19
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Get dependencies
run: |
go env
go get -v -t -d ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: image_name
run: echo ${{ env.IMAGE_NAME }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: vars
run: |
echo "::set-output name=file_name::$(ls dist/juno_*linux* |cut -c 6-)"
- name: Build and push Docker image
uses: mr-smithers-excellent/[email protected]
with:
registry: ${{ env.REGISTRY }}
image: ${{ env.IMAGE_NAME }}
buildArgs: "JUNO_TAR=${{ steps.vars.outputs.file_name }}"
addLatest: true
directory: dist
dockerfile: ./cmd/juno-admin/Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push MySQL image
uses: mr-smithers-excellent/[email protected]
with:
registry: ${{ env.REGISTRY }}
image: ${{ env.MYSQL_IMAGE_NAME }}
addLatest: true
directory: deployment/dockerfiles/mysql
dockerfile: deployment/dockerfiles/mysql/Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate install.yml
run: |
make gen-dev-deployment
# Ignore the error when we delete the latest release, it might not exist.
- name: Delete the latest Release
continue-on-error: true
run: |
gh release delete latest --repo $GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository_owner }}/${{ github.event.repository.name }}
# Ignore the error when we delete the latest tag, it might not exist.
- name: Delete the latest Tag
continue-on-error: true
run:
gh api --method DELETE /repos/$GITHUB_REPOSITORY/git/refs/tags/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository_owner }}/${{ github.event.repository.name }}
- name: Recreate the latest Release and Tag
uses: softprops/action-gh-release@v1
with:
draft: false
prerelease: true
tag_name: latest
files: |
./dist/juno_0.0.0-SNAPSHOT-*
./deployment/install.yml
./deployment/install-mirror.yml
body: |
This is the "latest" release of **Juno**, which contains the most recent commits from the main branch.
This release **might not be stable**.
It is only intended for developers wishing to try out the latest features in Juno, some of which may not be fully implemented.