release #1081
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: release | |
# To run relase process manually, run the following command. | |
# $curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/reviewdog/nightly/dispatches -d '{"event_type":"release"}' | |
on: | |
schedule: | |
- cron: "14 20 * * *" # Runs at 20:14 UTC (5:14 JST) every day. | |
repository_dispatch: | |
types: [release] | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: "reviewdog/reviewdog" | |
- name: Setup | |
run: | | |
git fetch --tags | |
git fetch --prune --unshallow | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: Add tag | |
run: | | |
NEW_SHA="$(git rev-parse --short HEAD)" | |
echo "NEW_SHA=${NEW_SHA}" >> $GITHUB_ENV | |
git tag -a "$(git describe --abbrev=0 --tags)-nightly$(date +%Y%m%d)+${NEW_SHA}" -m "nightly release" | |
- name: Set previous sha/tag | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# ref: https://goreleaser.com/customization/#Release | |
PREVIOUS_TAG="$(curl -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/reviewdog/nightly/releases | jq -r '.[0].tag_name')" | |
PREVIOUS_SHA="$(echo "${PREVIOUS_TAG}" | grep -oP '.*\+\K.*' )" | |
if [ -n "${PREVIOUS_SHA}" ]; then | |
git tag -a "${PREVIOUS_TAG}" -m "prev-nightly" "${PREVIOUS_SHA}" && \ | |
echo "PREVIOUS_SHA=${PREVIOUS_SHA}" >> $GITHUB_ENV && \ | |
echo "GORELEASER_PREVIOUS_TAG=${PREVIOUS_TAG}" >> $GITHUB_ENV | |
fi | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- uses: goreleaser/goreleaser-action@v6 | |
if: env.NEW_SHA != env.PREVIOUS_SHA | |
with: | |
version: "~> v2" | |
args: release --clean --config=.goreleaser-nightly.yml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test installation | |
run: | | |
curl -sfL https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh| sh -s | |
./bin/reviewdog -version |