-
Notifications
You must be signed in to change notification settings - Fork 5
65 lines (59 loc) · 1.74 KB
/
build-and-release.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
name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- run: make test/unit
- run: make -j$(( $(nproc) + 1 ))
- uses: actions/upload-artifact@v2
with:
name: Terraform.tgz
path: .build/latest/Terraform.tgz
release:
if: startsWith(github.ref, 'refs/tags/v')
name: Release
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/download-artifact@v3
with:
name: Terraform.tgz
- name: create draft release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.CI_USER_ACCESS_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: true
- name: upload docset to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.CI_USER_ACCESS_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Terraform.tgz
asset_name: Terraform.tgz
asset_content_type: application/gzip
- name: publish release
env:
GITHUB_TOKEN: ${{ secrets.CI_USER_ACCESS_TOKEN }}
run: |
curl \
--show-error --fail -i \
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${{ steps.create_release.outputs.id }}" \
-XPATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
-d '{"draft": false}'