Remove deprecated methods in goreleaser #218
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: | |
branches: [ master ] | |
paths-ignore: | |
- '**/README.md' | |
- '**/.github/images/**' | |
pull_request: | |
branches: [ master ] | |
paths-ignore: | |
- '**/README.md' | |
- '**/.github/images/**' | |
jobs: | |
# check our go files | |
go-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
stable: 'false' | |
go-version: '1.18' | |
- name: Lint | |
run: | | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.2 | |
golangci-lint run | |
# check our dockerfiles | |
dockerfile-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Lint Dockerfile | |
uses: hadolint/hadolint-action@master | |
with: | |
dockerfile: "Dockerfile" | |
# make sure our tests are passing | |
test: | |
strategy: | |
matrix: | |
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x] | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Tidy | |
run: go mod tidy | |
- name: Test | |
run: go test -v ./... | |
# make sure go build works on various OS/Go versions | |
build: | |
strategy: | |
matrix: | |
go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x] | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
# only run this job if the "test" job has passed | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.18' | |
- name: Build | |
run: go build -v ./... | |
# build and push image to docker registries | |
# (github packages & docker hub) | |
docker-build-push-image: | |
runs-on: ubuntu-latest | |
# oonly build/push image if the build job passed | |
needs: [build] | |
# don't push on pull requests | |
if: github.event_name != 'pull_request' | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
flavor: | | |
latest=true | |
tags: | | |
type=raw,enable=true,value=latest | |
images: | | |
hivacruz/moviestills | |
ghcr.io/${{ github.repository }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# Uploading the README.md is not a core feature of docker/build-push-action yet | |
- name: push README to Dockerhub | |
uses: christian-korneck/update-container-description-action@v1 | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASS: ${{ secrets.DOCKERHUB_PASS }} | |
with: | |
destination_container_repo: hivacruz/moviestills | |
provider: dockerhub | |
short_description: "Docker image for moviestills, a small CLI app to download movie snapshots." | |
readme_file: 'README.md' |