diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b9d7e4b..945e49c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,23 +4,15 @@ on: pull_request: {} push: branches: - - master + - master jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Run linters - run: make lint + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Run linters + run: make lint diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index d40ce75..df0bf3f 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -3,29 +3,21 @@ name: Master on: push: branches: - - master + - master jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Build docker images - run: make docker-build -e IMG_TAG=${GITHUB_REF#refs/heads/} - - name: Login to Docker hub - run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" - - name: Login to quay.io - run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io - - name: Push docker images - run: make docker-push -e IMG_TAG=${GITHUB_REF#refs/heads/} + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Build docker images + run: make docker-build -e IMG_TAG=${GITHUB_REF#refs/heads/} + - name: Login to Docker hub + run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" + - name: Login to quay.io + run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io + - name: Push docker images + run: make docker-push -e IMG_TAG=${GITHUB_REF#refs/heads/} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67af10c..efa965d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,49 +3,41 @@ name: Release on: push: tags: - - "*" + - "*" jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Import GPG signing key - uses: crazy-max/ghaction-import-gpg@v4 - with: - gpg_private_key: ${{ secrets.SIGNING_KEY }} - - name: Login to Docker hub - run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" - - name: Login to quay.io - run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io - - name: Build changelog from PRs with labels - id: build_changelog - uses: mikepenz/release-changelog-builder-action@v2 - with: - configuration: ".github/changelog-configuration.json" - # PreReleases still get a changelog, but the next full release gets a diff since the last full release, - # combining possible changelogs of all previous PreReleases in between. PreReleases show a partial changelog - # since last PreRelease. - ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" - outputFile: .github/release-notes.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish releases - uses: goreleaser/goreleaser-action@v2 - with: - args: release --release-notes .github/release-notes.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Import GPG signing key + uses: crazy-max/ghaction-import-gpg@v4 + with: + gpg_private_key: ${{ secrets.SIGNING_KEY }} + - name: Login to Docker hub + run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASSWORD }}" + - name: Login to quay.io + run: docker login -u "${{ secrets.QUAY_IO_USER }}" -p "${{ secrets.QUAY_IO_PASSWORD }}" quay.io + - name: Build changelog from PRs with labels + id: build_changelog + uses: mikepenz/release-changelog-builder-action@v2 + with: + configuration: ".github/changelog-configuration.json" + # PreReleases still get a changelog, but the next full release gets a diff since the last full release, + # combining possible changelogs of all previous PreReleases in between. PreReleases show a partial changelog + # since last PreRelease. + ignorePreReleases: "${{ !contains(github.ref, '-rc') }}" + outputFile: .github/release-notes.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish releases + uses: goreleaser/goreleaser-action@v2 + with: + args: release --release-notes .github/release-notes.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e7f9fb7..45c9efa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,28 +3,20 @@ name: Test on: push: branches: - - master + - master pull_request: branches: - - master + - master jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Determine Go version from go.mod - run: echo "GO_VERSION=$(grep "go 1." go.mod | cut -d " " -f 2)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Run tests - run: make test + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Run tests + run: make test