chore(depot): build with depot #881
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: Build, Test and Publish | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
on: | |
push: | |
branches: ['master'] | |
paths-ignore: | |
- 'CHANGELOG.md' | |
pull_request: | |
paths-ignore: | |
- 'CHANGELOG.md' | |
jobs: | |
test-and-build: | |
runs-on: depot-ubuntu-24.04-2 | |
steps: | |
- uses: actions/checkout@v3 | |
# Copy pasted from nestoca/actions since we cannot import private repos. | |
- name: Set git identity | |
shell: bash | |
run: |- | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Setup Go environment | |
uses: actions/setup-go@v3.3.1 | |
with: | |
go-version-file: go.mod | |
# Used to specify whether caching is needed. Set to true, if you'd like to enable caching. | |
cache: true | |
# Used to specify the path to a dependency file - go.sum | |
cache-dependency-path: go.sum | |
- name: Install Helm | |
shell: bash | |
run: | | |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | |
chmod 700 get_helm.sh | |
./get_helm.sh | |
- name: Setup dependencies | |
run: make setup | |
- name: Run tests w/ Coverage | |
env: | |
CATALOG_TEST_REPO: https://${{ secrets.GH_JOY_TEST }}@github.com/nestoca/joy-catalog-test | |
GH_TOKEN: ${{ secrets.GH_JOY_TEST }} | |
run: make test-cov | |
- name: Build cli binary | |
run: make build | |
test-internal: | |
runs-on: depot-ubuntu-24.04-2 | |
steps: | |
- name: Dispatch workflow | |
env: | |
GH_TOKEN: ${{ secrets.CATALOG_TRIGGER_TOKEN }} | |
run: | | |
gh workflow run --repo github.com/nestoca/catalog -f ref=${{ github.head_ref }} .github/workflows/joy-test.yaml | |
sleep 5s | |
workflowId=$(gh run ls --repo github.com/nestoca/catalog --workflow joy-test --json databaseId -q '.[0].databaseId') | |
gh run watch --exit-status --repo github.com/nestoca/catalog $workflowId | |
publish: | |
needs: | |
- test-and-build | |
runs-on: depot-ubuntu-24.04-2 | |
if: github.ref == 'refs/heads/master' | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_JOY_CHANGE_LOG_TOKEN }} | |
fetch-depth: 0 | |
- name: Setup Go environment | |
uses: actions/setup-go@v3.3.1 | |
with: | |
go-version-file: go.mod | |
# Used to specify whether caching is needed. Set to true, if you'd like to enable caching. | |
cache: true | |
# Used to specify the path to a dependency file - go.sum | |
cache-dependency-path: go.sum | |
- name: Generate changelog and tag release | |
id: changelog | |
uses: nestoca/conventional-changelog-action@releases/v4 | |
with: | |
preset: conventionalcommits # default is `angular` and does not support breaking changes of type feat! | |
input-file: CHANGELOG.md | |
output-file: CHANGELOG.md | |
fallback-version: 0.0.0 | |
skip-on-empty: false | |
skip-commit: true | |
skip-version-file: true | |
skip-tag: true | |
git-push: false | |
- name: Write changelog to temp file for goreleaser | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: echo "${{ steps.changelog.outputs.clean_changelog }}" > ${{ runner.temp }}/CHANGELOG.md | |
- name: Commit release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "chore(release): ${{ steps.changelog.outputs.tag }}" | |
- name: Tag commit | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: git tag ${{ steps.changelog.outputs.tag }} | |
- name: Push changelog | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: | | |
git push origin master | |
- name: Release new CLI version | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
version: ~> v1 | |
args: release --clean --release-notes "${{ runner.temp }}/CHANGELOG.md" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_HOMEBREW_PUBLIC_TOKEN }} |