-
Notifications
You must be signed in to change notification settings - Fork 15
121 lines (105 loc) · 3.59 KB
/
build.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
name: Build and push the chain image
on:
push:
tags:
- '*'
workflow_dispatch:
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
REGISTRY_ADDRESS: rg.fr-par.scw.cloud/lum-network
REGISTRY_ADDRESS_PROJECT: chain
jobs:
bump-version-push-tag:
name: Bump version and push new tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: '0'
- name: Bump version and push new tag
id: bump_version
uses: anothrNick/github-tag-action@1.36.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: production
- name: Save new version number result into file
shell: bash
run: |
echo ${{ steps.bump_version.outputs.tag }} > new_version.txt
- name: Upload version number for further use
uses: actions/upload-artifact@v1
with:
name: new_version
path: new_version.txt
build-docker:
name: Build the image and push on docker registry
runs-on: ubuntu-latest
needs: bump-version-push-tag
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download version number from bump-version-push-tag
uses: actions/download-artifact@v1
with:
name: new_version
- name: Create version number variable
id: vars
run: echo ::set-output name=version_tag_number::$(cat new_version/new_version.txt)
- name: Build, tag and push the built image
run: |
docker login $REGISTRY_ADDRESS -u nologin -p $REGISTRY_TOKEN
docker build -t $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:latest -t $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:"${{ steps.vars.outputs.version_tag_number }}" .
docker push $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:${{ steps.vars.outputs.version_tag_number }}
docker push $REGISTRY_ADDRESS/$REGISTRY_ADDRESS_PROJECT:latest
build-release:
needs: bump-version-push-tag
strategy:
matrix:
arch: [ amd64, arm64 ]
targetos: [ macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.targetos }}
name: Build the lum daemon on ${{ matrix.arch }} for ${{ matrix.targetos }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.4
with:
go-version: '^1.20'
- name: Compile lumd
run: |
go mod tidy
go mod download
cd cmd/lumd
go build .
- uses: papeloto/action-zip@v1
with:
files: cmd/lumd/lumd
dest: lumd_${{ matrix.targetos }}_${{ matrix.arch }}.zip
- uses: actions/upload-artifact@v2
with:
name: lumd_${{ matrix.targetos }}_${{ matrix.arch }}
path: lumd_${{ matrix.targetos }}_${{ matrix.arch }}.zip
release-on-github:
name: Release on Github
needs: build-release
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Display structure of downloaded files
run: ls -lR
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{github.ref_name}}
release_name: ${{github.ref_name}}
- name: Upload release assets
uses: csexton/release-asset-action@v2
with:
pattern: "**/*.zip"
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ steps.create_release.outputs.upload_url }}