forked from cloudquery/cloudquery
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (90 loc) · 3.42 KB
/
Copy pathrelease_cli.yml
File metadata and controls
96 lines (90 loc) · 3.42 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
name: release-cli
on:
push:
tags:
- "cli-v*.*.*"
env:
CGO_ENABLED: 0
jobs:
release-cli:
timeout-minutes: 30
runs-on: large-ubuntu-monorepo
steps:
# Tag format is cli-<version>
- name: Split tag
id: split
run: |
tag=${{github.ref_name}}
echo "version=$(echo $tag | cut -d- -f2-)" >> $GITHUB_OUTPUT
# Fail if not a valid SemVer string
- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@7784200024d6b3fc01253e617ec0168daf603de3
with:
input_string: ${{steps.split.outputs.version}}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-1.21.1-release-cache-${{ hashFiles('cli/go.sum') }}
restore-keys: |
${{ runner.os }}-go-1.21.1-release-cache-cli
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version-file: cli/go.mod
cache: false
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser-pro
version: latest
install-only: true
- name: Run GoReleaser Dry-Run
run: goreleaser release --clean --skip=validate,publish -f ./cli/.goreleaser.yaml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
- name: Login to Docker Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
# Publish to GitHub and Homebrew
- name: Run GoReleaser Release
if: steps.semver_parser.outputs.prerelease == ''
run: goreleaser release --clean -f ./cli/.goreleaser.yaml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
# A custom token is required for publishing to Homebrew
GITHUB_TOKEN: ${{ secrets.GH_CQ_BOT }}
# Publish only to GitHub
- name: Run GoReleaser PreRelease
if: steps.semver_parser.outputs.prerelease != ''
run: goreleaser release --clean -f ./cli/.goreleaser.prerelease.yaml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
# A custom token is required for publishing to Homebrew
GITHUB_TOKEN: ${{ secrets.GH_CQ_BOT }}
- name: Update version file
if: steps.semver_parser.outputs.prerelease == ''
run: 'echo "{ \"latest\": \"${{github.ref_name}}\" }" > ./website/versions/cli.json'
- name: Create Pull Request
if: steps.semver_parser.outputs.prerelease == ''
uses: peter-evans/create-pull-request@v4
with:
# required so the PR triggers workflow runs
token: ${{ secrets.GH_CQ_BOT }}
branch: chore/update-cli-version
base: main
title: "chore: Update CLI version to ${{steps.split.outputs.version}}"
commit-message: "chore: Update CLI version to ${{steps.split.outputs.version}}"
body: Updates the CLI latest version to ${{steps.split.outputs.version}}
labels: automerge
author: cq-bot <cq-bot@users.noreply.github.com>