-
Notifications
You must be signed in to change notification settings - Fork 3
139 lines (139 loc) · 5.14 KB
/
main.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
132
133
134
135
136
137
138
139
name: blockchyp-go
on:
push:
branches:
- "develop"
- "master"
- "preview"
tags:
- "*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
test:
runs-on: ubuntu-latest
container:
image: golang:1.20-buster
steps:
- uses: act10ns/slack@v1
with:
status: starting
channel: '#gitactivity'
if: always()
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Granting private modules access
run: git config --global url."https://${{ secrets.SDK_GEN_REPO_TOKEN }}:[email protected]/blockchyp".insteadOf "https://github.com/blockchyp"
- name: Temporary Git Workaround
run: git config --global --add safe.directory /__w/blockchyp-go/blockchyp-go
if: github.repository == 'blockchyp/blockchyp-go'
- name: Temporary Git Workaround (internal repo)
run: git config --global --add safe.directory /__w/blockchyp-go-internal/blockchyp-go-internal
if: github.repository == 'blockchyp/blockchyp-go-internal'
- name: Lint
run: make lint
- name: Run Tests
run: make test
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
channel: '#gitactivity'
if: always()
test-build:
runs-on: ubuntu-latest
container:
image: golang:1.20-buster
if: ${{ always() && contains(join(needs.*.result, ','), 'success') && (contains(github.ref_name, 'preview') || contains(github.ref_name, 'develop')) }}
needs: [ test ]
steps:
- uses: act10ns/slack@v1
with:
status: starting
channel: '#gitactivity'
if: always()
- name: Update APT
run: apt update -y
- name: Install Zip
run: apt install zip -y
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Granting private modules access
run: git config --global url."https://${{ secrets.SDK_GEN_REPO_TOKEN }}:[email protected]/blockchyp".insteadOf "https://github.com/blockchyp"
- name: Temporary Git Workaround
run: git config --global --add safe.directory /__w/blockchyp-go/blockchyp-go
if: github.repository == 'blockchyp/blockchyp-go'
- name: Temporary Git Workaround (internal repo)
run: git config --global --add safe.directory /__w/blockchyp-go-internal/blockchyp-go-internal
if: github.repository == 'blockchyp/blockchyp-go-internal'
- name: Run Build
run: make build
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
channel: '#gitactivity'
if: always()
publish:
runs-on: ubuntu-latest
container:
image: golang:1.20-buster
if: ${{ always() && contains(join(needs.*.result, ','), 'success') && startsWith(github.ref_name, 'v') }}
needs: [ test ]
steps:
- uses: act10ns/slack@v1
with:
status: starting
channel: '#gitactivity'
if: always()
- name: Update APT
run: apt update -y
- name: Install Zip
run: apt install zip -y
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Granting private modules access
run: git config --global url."https://${{ secrets.SDK_GEN_REPO_TOKEN }}:[email protected]/blockchyp".insteadOf "https://github.com/blockchyp"
- name: Temporary Git Workaround
run: git config --global --add safe.directory /__w/blockchyp-go/blockchyp-go
if: github.repository == 'blockchyp/blockchyp-go'
- name: Temporary Git Workaround (internal repo)
run: git config --global --add safe.directory /__w/blockchyp-go-internal/blockchyp-go-internal
if: github.repository == 'blockchyp/blockchyp-go-internal'
- name: Run Build
run: make build
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: true
prerelease: false
- name: Upload Zip Artifact
uses: actions/[email protected]
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/dist/blockchyp-cli-${{ github.ref_name }}.zip
asset_name: blockchyp-cli-${{ github.ref_name }}.zip
asset_content_type: application/zip
- name: Upload Tar Artifact
uses: actions/[email protected]
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/dist/blockchyp-cli-${{ github.ref_name }}.tar.gz
asset_name: blockchyp-cli-${{ github.ref_name }}.tar.gz
asset_content_type: application/gzip
- uses: eregon/publish-release@v1
with:
release_id: ${{ steps.create_release.outputs.id }}
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
channel: '#gitactivity'
if: always()