Merge pull request #15 from WillAbides/release-train #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
types: [ synchronize, opened, reopened, labeled, unlabeled ] | |
jobs: | |
cibuild: | |
name: cibuild | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: WillAbides/setup-go-faster@v1 | |
id: setup-go | |
with: | |
go-version: '1.20.x' | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.setup-go.outputs.GOCACHE }} | |
${{ steps.setup-go.outputs.GOMODCACHE }} | |
key: ${{ runner.os }}-go-${{ hashFiles('go.*', '.github/workflows/ci.yaml', 'script/*', '.bindown.yaml', '.goreleaser.yaml') }} | |
restore-keys: ${{ runner.os }}-go- | |
- name: git config | |
run: | | |
git config --local user.name '${{ github.actor }}' | |
git config --local user.email '${{ github.actor }}@users.noreply.github.com' | |
- name: script/cibuild | |
run: script/cibuild | |
- uses: WillAbides/[email protected] | |
with: | |
# set create-release: true when ready to start releasing | |
create-release: false | |
release-refs: main | |
pre-tag-hook: script/release-hook | |
# This can be deleted if this repo isn't going to publish a binary | |
- name: add bindown template | |
env: | |
RELEASE_TAG: ${{ steps.release-train.outputs.release-tag }} | |
GH_TOKEN: ${{ github.token }} | |
if: steps.release-train.outputs.created-release == 'true' && hashFiles('.goreleaser.yaml') != '' | |
run: | | |
#!/bin/sh | |
set -e | |
script/bindown -q install gh | |
CONFIG_FILE="$(pwd)/tmp/add-tmpl/bindown.yaml" | |
mkdir -p "$(dirname "$CONFIG_FILE")" | |
echo '{}' > "$CONFIG_FILE" | |
yes '' | script/bindown dependency add-by-github-release \ | |
"$GITHUB_REPOSITORY" \ | |
--configfile "$CONFIG_FILE" \ | |
--experimental | |
bin/gh release upload "$RELEASE_TAG" "$CONFIG_FILE" |