Merge #22 #30
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: Merge | |
on: | |
push: | |
branches: | |
- staging | |
- trying | |
tags-ignore: | |
- "*" | |
jobs: | |
info: | |
name: Gather info | |
runs-on: ubuntu-latest | |
outputs: | |
version: "${{ fromJSON(steps.version.outputs.version) }}" | |
release_notes: "${{ fromJSON(steps.notes.outputs.release_notes) }}" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Compute version | |
id: version | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed to get previous version | |
run: | | |
# Sets output VERSION | |
VERSION="$(./.github/scripts/get-version)" | |
./.github/scripts/set-output version "${VERSION}" | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19.x | |
cache: true | |
- name: Extract release notes | |
id: notes | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed to get previous version | |
run: | | |
PREVIOUS_VERSION="$(./.github/scripts/get-previous-version)" | |
CHANGELOG="$(./.github/scripts/get-changelog "${PREVIOUS_VERSION}" --version "${{ fromJSON(steps.version.outputs.version) }}")" | |
./.github/scripts/set-output release_notes "${CHANGELOG}" | |
version-check: | |
# ensure versions in the repo match the intended publish version | |
name: Version Check | |
needs: [info] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
VERSION="${{ needs.info.outputs.version }}" | |
./.github/scripts/update-versions "$VERSION" | |
ERROR=false | |
if [ -n "$(git status --porcelain)" ]; then | |
ERROR=true | |
echo "::error::Versions in files do not match expected version $VERSION." | |
echo "::group::git diff" | |
git diff | |
echo "::endgroup::" | |
fi | |
if EXISTING_RELEASE="$(gh release view "v${VERSION}")"; then | |
echo "::error::This version has already been released!" | |
echo "::group::Release $VERSION" | |
echo "$EXISTING_RELEASE" | |
echo "::endgroup::" | |
fi | |
if $ERROR; then | |
exit 1; | |
fi | |
lint: | |
name: Lint | |
uses: ./.github/workflows/ci-lint.yml | |
build: | |
name: Build | |
needs: [info] | |
uses: ./.github/workflows/ci-build.yml | |
with: | |
version: ${{ needs.info.outputs.version }} | |
secrets: inherit | |
build-ok: | |
# bors watches for this check | |
name: Build OK | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo OK | |
unit-test-go: | |
name: Unit Test | |
uses: ./.github/workflows/ci-unit-test.yml | |
unit-test-ok: | |
name: Unit Test OK | |
needs: [unit-test-go] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo OK | |
integration-test: | |
name: Integration Test | |
needs: [info, build] | |
uses: ./.github/workflows/ci-integration-test.yml | |
with: | |
version: ${{ needs.info.outputs.version }} | |
test-ok: | |
# bors watches for this check | |
name: Test OK | |
needs: [lint, unit-test-ok, integration-test] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo OK | |
publish: | |
name: Publish | |
needs: [test-ok, version-check, info] | |
uses: ./.github/workflows/ci-publish.yml | |
if: ${{ github.ref_name == 'staging' }} | |
with: | |
version: ${{ needs.info.outputs.version }} | |
release_notes: ${{ needs.info.outputs.release_notes }} | |
project: ${{ github.repository }} | |
commit: ${{ github.sha }} | |
secrets: inherit | |
publish-ok: | |
# bors watches for this check | |
name: Publish OK | |
needs: [publish] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo OK # test, block release |