chore(deps): update actions/cache action to v5.0.2 #553
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: Build | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| name: build | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Go environment | |
| uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 | |
| with: | |
| version: v2.13.2 # renovate: datasource=github-tags depName=goreleaser packageName=goreleaser/goreleaser | |
| args: build --single-target --snapshot --clean --output ./version | |
| env: | |
| GORELEASER_CURRENT_TAG: ${{ steps.draft_release.outputs.tag_name }} | |
| - name: Version test | |
| id: version | |
| run: echo "output=$(./version bump 0.1.0)" >> "$GITHUB_OUTPUT" | |
| - name: Failed | |
| if: ${{ steps.version.outputs.output != '0.1.1' }} | |
| run: |- | |
| exit 1 | |
| - name: Success | |
| if: ${{ steps.version.outputs.output == '0.1.1' }} | |
| run: |- | |
| exit 0 | |
| docker-build: | |
| name: docker build | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
| - name: Extract base image info | |
| id: base_image | |
| run: | | |
| BASE_IMAGE_FULL=$(grep -i '^FROM' Dockerfile | tail -n 1 | awk '{print $2}') | |
| if [[ "$BASE_IMAGE_FULL" == "scratch" ]]; then | |
| echo "name=scratch" >> $GITHUB_OUTPUT | |
| echo "digest=" >> $GITHUB_OUTPUT | |
| else | |
| echo "name=$(echo "$BASE_IMAGE_FULL" | cut -d'@' -f1)" >> $GITHUB_OUTPUT | |
| echo "digest=$(echo "$BASE_IMAGE_FULL" | cut -d'@' -f2)" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build Docker image (multi-platform) | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| platforms: | | |
| linux/amd64 | |
| linux/arm64 | |
| linux/arm/v8 | |
| linux/ppc64le | |
| linux/arm/v7 | |
| tags: ghcr.io/version-cli/version:dev | |
| labels: | | |
| authors=Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com> | |
| org.opencontainers.image.created=${{ steps.date.outputs.date }} | |
| org.opencontainers.image.authors=Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com> | |
| org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.documentation="https://www.version-cli.app" | |
| org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.version=${{ github.sha }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| org.opencontainers.image.vendor="version-cli" | |
| org.opencontainers.image.licenses=# TODO: add license | |
| org.opencontainers.image.ref.name=${{ github.sha }} | |
| org.opencontainers.image.title=${{ github.event.repository.name }} | |
| org.opencontainers.image.description=${{ github.event.repository.description }} | |
| org.opencontainers.image.base.digest=${{ steps.base_image.outputs.name }} | |
| org.opencontainers.image.base.name=${{ steps.base_image.outputs.digest }} | |
| build-args: | | |
| VERSION=${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build Docker image (smoke test) | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| load: true | |
| tags: ghcr.io/version-cli/version:dev | |
| labels: | | |
| authors=Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com> | |
| org.opencontainers.image.created=${{ steps.date.outputs.date }} | |
| org.opencontainers.image.authors=Koen van Zuijlen <8818390+kvanzuijlen@users.noreply.github.com> | |
| org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.documentation="https://www.version-cli.app" | |
| org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.version=${{ github.sha }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| org.opencontainers.image.vendor="version-cli" | |
| org.opencontainers.image.licenses=# TODO: add license | |
| org.opencontainers.image.ref.name=${{ github.sha }} | |
| org.opencontainers.image.title=${{ github.event.repository.name }} | |
| org.opencontainers.image.description=${{ github.event.repository.description }} | |
| org.opencontainers.image.base.digest=${{ steps.base_image.outputs.name }} | |
| org.opencontainers.image.base.name=${{ steps.base_image.outputs.digest }} | |
| build-args: | | |
| VERSION=${{ github.sha }} | |
| cache-from: type=gha | |
| - name: Version test | |
| id: version | |
| run: |- | |
| echo "output=$(docker run ghcr.io/version-cli/version:dev bump 0.1.0)" >> "$GITHUB_OUTPUT" | |
| - name: Failed | |
| if: ${{ steps.version.outputs.output != '0.1.1' }} | |
| run: |- | |
| exit 1 | |
| - name: Success | |
| if: ${{ steps.version.outputs.output == '0.1.1' }} | |
| run: |- | |
| exit 0 |