This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
build(deps): bump github.com/bitfield/script from 0.21.4 to 0.22.0 #48
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: cmp-ytt | |
on: | |
pull_request: | |
push: | |
jobs: | |
check-dockerhub-token: | |
runs-on: ubuntu-latest | |
outputs: | |
HAS_DOCKERHUB_TOKEN: ${{ steps.dockerhub-token.outputs.HAS_DOCKERHUB_TOKEN }} | |
steps: | |
- id: dockerhub-token | |
env: | |
HAS_DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN != '' }} | |
run: | | |
echo "HAS_DOCKERHUB_TOKEN=$HAS_DOCKERHUB_TOKEN" >> $GITHUB_OUTPUT | |
echo "HAS_DOCKERHUB_TOKEN=$HAS_DOCKERHUB_TOKEN" >> $GITHUB_STEP_SUMMARY | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Install golangci-lint | |
uses: golangci/golangci-lint-action@master | |
with: | |
version: v1.50.1 | |
build: | |
needs: | |
- lint | |
- check-dockerhub-token | |
if: | | |
!startsWith(github.ref, 'refs/tags/v') && | |
needs.check-dockerhub-token.outputs.HAS_DOCKERHUB_TOKEN == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --rm-dist --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: List snapshot images | |
run: | | |
docker image ls --format "{{.Repository}}:{{.Tag}}" | \ | |
grep -e "$GITHUB_REPOSITORY:.*$(git rev-parse --short HEAD).*" | \ | |
paste -sd ' ' /dev/stdin > images | |
- name: Push snapshot images | |
run: | | |
cat images | xargs -d ' ' -I{} -n1 sh -c "docker push {}" | |
- name: Create and push manifest for :snapshot tag | |
run: | | |
docker manifest create $GITHUB_REPOSITORY:snapshot $(cat images) | |
docker manifest push $GITHUB_REPOSITORY:snapshot | |
release: | |
needs: | |
- lint | |
- check-dockerhub-token | |
if: | | |
startsWith(github.ref, 'refs/tags/v') && | |
needs.check-dockerhub-token.outputs.HAS_DOCKERHUB_TOKEN == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |