Skip to content

chore: update release workflows #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 40 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
version: latest
version: v2.10.2
args: release -f .goreleaser/mac.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
Expand Down Expand Up @@ -49,9 +49,9 @@ jobs:
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
version: latest
version: v2.10.2
args: release -f .goreleaser/linux.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
Expand All @@ -70,41 +70,40 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
version: v2.10.2
args: release -f .goreleaser/windows.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}

build-windows-npm:
runs-on: windows-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release -f .goreleaser/windows-npm.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}

publish-npm:
runs-on: ubuntu-latest
needs: [build-windows-npm, build-linux, build-mac]
needs: [build-windows, build-linux, build-mac]
steps:
- uses: actions/checkout@v4
with:
# Checkout on main so that the later commit works
ref: main
# With permission to push to a protected branch
token: ${{ secrets.READ_WRITE_PAT }}

fetch-depth: 0 # Required to find branches for a tag

- name: Determine release branch
id: get_branch
run: |
# Find the branch that contains the tag.
# Prefers 'main', then 'master', then the first branch found.
BRANCHES=$(git branch -r --contains ${{ github.ref_name }} | sed 's/ *origin\///' | grep -v HEAD)
if echo "$BRANCHES" | grep -q -w "main"; then
RELEASE_BRANCH="main"
elif echo "$BRANCHES" | grep -q -w "master"; then
RELEASE_BRANCH="master"
else
RELEASE_BRANCH=$(echo "$BRANCHES" | head -n 1)
fi
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT
echo "Determined release branch for commit: ${RELEASE_BRANCH}"

- name: Checkout release branch
run: git checkout ${{ steps.get_branch.outputs.RELEASE_BRANCH }}

- uses: actions/setup-node@v4
with:
node-version: "20.x"
Expand Down Expand Up @@ -133,6 +132,18 @@ jobs:
add: 'package.json'

- run: npm ci
- run: npm publish

- name: Determine npm tag for pre-releases
id: npm_tag
run: |
TAG_VERSION="${{ steps.tag-version.outputs.TAG_VERSION }}"
NPM_TAG="latest"
if [[ "$TAG_VERSION" == *-* ]]; then
NPM_TAG=$(echo "$TAG_VERSION" | cut -d'-' -f2 | cut -d'.' -f1)
fi
echo "tag=${NPM_TAG}" >> $GITHUB_OUTPUT
echo "npm tag: ${NPM_TAG}"

- run: npm publish --tag ${{ steps.npm_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29 changes: 5 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
version: latest
version: v2.10.2
args: release --skip=publish --snapshot -f .goreleaser/mac.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
Expand Down Expand Up @@ -55,9 +55,9 @@ jobs:
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
version: latest
version: v2.10.2
args: release --skip=publish --snapshot -f .goreleaser/linux.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
Expand All @@ -76,26 +76,7 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
version: v2.10.2
args: release --skip=publish --snapshot -f .goreleaser/windows.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}

build-windows-npm:
runs-on: windows-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --skip=publish --snapshot -f .goreleaser/windows-npm.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
14 changes: 8 additions & 6 deletions .goreleaser/linux.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
env:
- GO111MODULE=on
before:
Expand Down Expand Up @@ -55,8 +56,8 @@ dockers:
ids:
- hookdeck-linux
image_templates:
- "hookdeck/hookdeck-cli:latest-amd64"
- "hookdeck/hookdeck-cli:{{ .Tag }}-amd64"
- "{{ if not .Prerelease }}hookdeck/hookdeck-cli:latest-amd64{{ end }}"
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -71,8 +72,8 @@ dockers:
ids:
- hookdeck-linux-arm64
image_templates:
- "hookdeck/hookdeck-cli:latest-arm64"
- "hookdeck/hookdeck-cli:{{ .Tag }}-arm64"
- "{{ if not .Prerelease }}hookdeck/hookdeck-cli:latest-arm64{{ end }}"
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -83,11 +84,12 @@ dockers:
- "--label=homepage=https://hookdeck.com"
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: "hookdeck/hookdeck-cli:latest"
image_templates:
- "hookdeck/hookdeck-cli:latest-amd64"
- "hookdeck/hookdeck-cli:latest-arm64"
- name_template: "hookdeck/hookdeck-cli:{{ .Tag }}"
image_templates:
- "hookdeck/hookdeck-cli:{{ .Tag }}-amd64"
- "hookdeck/hookdeck-cli:{{ .Tag }}-arm64"
- name_template: "hookdeck/hookdeck-cli:latest"
image_templates:
- "hookdeck/hookdeck-cli:latest-amd64"
- "hookdeck/hookdeck-cli:latest-arm64"
skip_push: auto
36 changes: 19 additions & 17 deletions .goreleaser/mac.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
env:
- GO111MODULE=on
before:
Expand Down Expand Up @@ -36,28 +37,29 @@ checksum:
name_template: "{{ .ProjectName }}-checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
brews:
- repository:
homebrew_casks:
- name: hookdeck
repository:
owner: hookdeck
name: homebrew-hookdeck
commit_author:
name: hookdeck
email: [email protected]
homepage: https://hookdeck.com
description: Hookdeck CLI utility
install: |
bin.install "hookdeck"
rm Dir["#{bin}/{hookdeck-completion.bash,hookdeck-completion.zsh}"]
system bin/"hookdeck", "completion", "--shell", "bash"
system bin/"hookdeck", "completion", "--shell", "zsh"
bash_completion.install "hookdeck-completion.bash"
zsh_completion.install "hookdeck-completion.zsh"
(zsh_completion/"_hookdeck").write <<~EOS
#compdef hookdeck
_hookdeck () {
local e
e=$(dirname ${funcsourcetrace[1]%:*})/hookdeck-completion.zsh
if [[ -f $e ]]; then source $e; fi
}
EOS
caveats: "❤ Thanks for installing the Hookdeck CLI! If this is your first time using the CLI, be sure to run `hookdeck login` first."
custom_block: |
postflight do
system "hookdeck", "completion", "--shell", "bash"
system "hookdeck", "completion", "--shell", "zsh"
bash_completion.install "hookdeck-completion.bash"
zsh_completion.install "hookdeck-completion.zsh"
(zsh_completion/"_hookdeck").write <<~EOS
#compdef hookdeck
_hookdeck () {
local e
e=$(dirname ${funcsourcetrace[1]%:*})/hookdeck-completion.zsh
if [[ -f $e ]]; then source $e; fi
}
EOS
end
45 changes: 0 additions & 45 deletions .goreleaser/windows-npm.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .goreleaser/windows.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
env:
- GO111MODULE=on
before:
Expand Down Expand Up @@ -40,6 +41,7 @@ scoops:
- repository:
owner: hookdeck
name: scoop-hookdeck
name: "{{ if .Prerelease }}hookdeck-beta{{ else }}hookdeck{{ end }}"
commit_author:
name: hookdeck-ci
email: [email protected]
Expand Down