forked from GoogleCloudPlatform/cloud-foundation-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 3 KB
/
release-cli.yml
File metadata and controls
98 lines (86 loc) · 3 KB
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
name: Release new CLI versions
on:
push:
branches:
- "master"
paths:
- "cli/Makefile"
env:
CLI_BUCKET: gs://cft-cli
RELEASE_URL: https://api.github.com/repos/GoogleCloudPlatform/cloud-foundation-toolkit/releases/latest
jobs:
release-new-cli:
name: Build and push new CFT dev tools image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@master
with:
version: "286.0.0"
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Retrieve last released version
run: |-
LAST_VERSION=$(curl --silent "${{env.RELEASE_URL}}" | \
jq --raw-output .tag_name)
echo "LAST_VERSION=${LAST_VERSION}" >> $GITHUB_ENV
- name: Build
working-directory: ./cli
run: |-
make release
chmod +x bin/*
- name: Archive build artifacts
uses: actions/upload-artifact@v1
with:
name: bin
path: cli/bin
- name: Retrieve current version
working-directory: ./cli
run: |-
CURRENT_VERSION=$(./bin/cft-linux-amd64 version)
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Release new version
if: env.LAST_VERSION != env.CURRENT_VERSION
working-directory: ./cli
run: |-
make publish
- name: Create Release
if: env.LAST_VERSION != env.CURRENT_VERSION
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CURRENT_VERSION }}
release_name: CLI Release ${{ env.CURRENT_VERSION }}
draft: false
prerelease: false
- name: Upload Linux Release
if: env.LAST_VERSION != env.CURRENT_VERSION
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cli/bin/cft-linux-amd64
asset_name: cft-linux-amd64
asset_content_type: application/octet-stream
- name: Upload Darwin Release
if: env.LAST_VERSION != env.CURRENT_VERSION
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cli/bin/cft-darwin-amd64
asset_name: cft-darwin-amd64
asset_content_type: application/octet-stream
- name: Upload Windows Release
if: env.LAST_VERSION != env.CURRENT_VERSION
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cli/bin/cft-windows-amd64
asset_name: cft-windows-amd64
asset_content_type: application/octet-stream