ci: add test step #27
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 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.19" | |
cache: false | |
- name: setup envtest | |
run: | | |
make envtest | |
./bin/setup-envtest use 1.26.1 | |
- name: run tests | |
run: make test | |
release-please: | |
name: Release Please | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
release_created: ${{ steps.release-please.outputs.release_created }} | |
tag_name: ${{ steps.release-please.outputs.tag_name }} | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release-please | |
with: | |
command: manifest | |
- if: ${{ steps.release-please.outputs.release_created }} | |
id: version | |
name: Get raw version value from tag | |
run: |- | |
TAG="${{ steps.release-please.outputs.tag_name }}" | |
echo "version=${TAG/v/}" >> $GITHUB_OUTPUT | |
build: | |
name: Build and Publish | |
runs-on: ubuntu-latest | |
needs: [release-please] | |
if: ${{ needs.release-please.outputs.release_created }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
make save-manifests docker-build docker-push IMG=ghcr.io/krystal/generated-secrets:${{ needs.release-please.outputs.version }} | |
- env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ needs.release-please.outputs.tag_name }} manifest.yaml |