Merge pull request #5 from Wompipomp/release-please--branches--main #24
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| tags: ['v*', '!stdlib/v*'] | |
| permissions: | |
| packages: write | |
| contents: read | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE: ghcr.io/${{ github.repository_owner }}/function-starlark | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: '1.25' | |
| - run: go test -race -count=1 ./... | |
| release: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: '1.25' | |
| - name: Login to GHCR | |
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | |
| - name: Extract version and image name | |
| id: version | |
| run: | | |
| echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | |
| echo "image=$(echo '${{ env.IMAGE }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" | |
| - name: Build runtime image locally for xpkg embedding | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 | |
| with: | |
| context: . | |
| load: true | |
| tags: runtime:local | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Install crossplane CLI | |
| run: | | |
| XP_CHANNEL=stable XP_VERSION=v1.20.0 curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh | |
| sudo mv crossplane /usr/local/bin/ | |
| - name: Generate input CRD | |
| run: make generate | |
| - name: Build and push xpkg | |
| run: | | |
| crossplane xpkg build \ | |
| -f package \ | |
| --embed-runtime-image=runtime:local \ | |
| -o function-starlark.xpkg | |
| crossplane xpkg push \ | |
| -f function-starlark.xpkg \ | |
| ${{ steps.version.outputs.image }}:${{ steps.version.outputs.tag }} | |
| crossplane xpkg push \ | |
| -f function-starlark.xpkg \ | |
| ${{ steps.version.outputs.image }}:latest |