mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
chore(ci): update workflows
This commit is contained in:
parent
f9f982c144
commit
8d5eb97b1a
7 changed files with 2 additions and 32 deletions
166
.github/workflows/release.yaml
vendored
Normal file
166
.github/workflows/release.yaml
vendored
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
name: Release (Production)
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
- '**/v[0-9]+.[0-9]+.[0-9]+'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
- uses: dominikh/staticcheck-action@ba605356b4b29a60e87ab9404b712f3461e566dc #v1.3.0
|
||||
with:
|
||||
version: "2022.1.1"
|
||||
install-go: "false" # StaticCheck uses go v1.17 which does not support `any`
|
||||
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
matrix:
|
||||
go-version:
|
||||
- 1.20.x
|
||||
platform:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
- name: Run tests
|
||||
run: |
|
||||
go test ./... -coverprofile coverage.out
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- test
|
||||
- lint
|
||||
env:
|
||||
CGO_ENABLED: 0
|
||||
TAG: ${{ github.ref_name }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: 1.20.x
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc #v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build
|
||||
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # v3
|
||||
with:
|
||||
version: v0.155.0
|
||||
args: --debug
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Enable experimental docker features
|
||||
run: |
|
||||
mkdir -p ~/.docker/ && \
|
||||
echo '{"experimental": "enabled"}' > ~/.docker/config.json
|
||||
- name: Create manifest for version
|
||||
run: |
|
||||
export DH_TAG=$(git tag --points-at HEAD | sed 's/^v*//')
|
||||
docker manifest create \
|
||||
beatkind/watchtower:$DH_TAG \
|
||||
beatkind/watchtower:amd64-$DH_TAG \
|
||||
beatkind/watchtower:i386-$DH_TAG \
|
||||
beatkind/watchtower:armhf-$DH_TAG \
|
||||
beatkind/watchtower:arm64v8-$DH_TAG
|
||||
- name: Annotate manifest for version
|
||||
run: |
|
||||
for REPO in '' ghcr.io/ ; do
|
||||
|
||||
docker manifest annotate \
|
||||
${REPO}beatkind/watchtower:$(echo $TAG | sed 's/^v*//') \
|
||||
${REPO}beatkind/watchtower:i386-$(echo $TAG | sed 's/^v*//') \
|
||||
--os linux \
|
||||
--arch 386
|
||||
|
||||
docker manifest annotate \
|
||||
${REPO}beatkind/watchtower:$(echo $TAG | sed 's/^v*//') \
|
||||
${REPO}beatkind/watchtower:armhf-$(echo $TAG | sed 's/^v*//') \
|
||||
--os linux \
|
||||
--arch arm
|
||||
|
||||
docker manifest annotate \
|
||||
${REPO}beatkind/watchtower:$(echo $TAG | sed 's/^v*//') \
|
||||
${REPO}beatkind/watchtower:arm64v8-$(echo $TAG | sed 's/^v*//') \
|
||||
--os linux \
|
||||
--arch arm64 \
|
||||
--variant v8
|
||||
|
||||
done
|
||||
- name: Create manifest for latest
|
||||
run: |
|
||||
docker manifest create \
|
||||
beatkind/watchtower:latest \
|
||||
beatkind/watchtower:amd64-latest \
|
||||
beatkind/watchtower:i386-latest \
|
||||
beatkind/watchtower:armhf-latest \
|
||||
beatkind/watchtower:arm64v8-latest
|
||||
- name: Annotate manifest for latest
|
||||
run: |
|
||||
for REPO in '' ghcr.io/ ; do
|
||||
|
||||
docker manifest annotate \
|
||||
${REPO}beatkind/watchtower:latest \
|
||||
${REPO}beatkind/watchtower:i386-latest \
|
||||
--os linux \
|
||||
--arch 386
|
||||
|
||||
docker manifest annotate \
|
||||
${REPO}beatkind/watchtower:latest \
|
||||
${REPO}beatkind/watchtower:armhf-latest \
|
||||
--os linux \
|
||||
--arch arm
|
||||
|
||||
docker manifest annotate \
|
||||
${REPO}beatkind/watchtower:latest \
|
||||
${REPO}beatkind/watchtower:arm64v8-latest \
|
||||
--os linux \
|
||||
--arch arm64 \
|
||||
--variant v8
|
||||
|
||||
done
|
||||
- name: Push manifests to Dockerhub
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_TOKEN && \
|
||||
docker manifest push beatkind/watchtower:$(echo $TAG | sed 's/^v*//') && \
|
||||
docker manifest push beatkind/watchtower:latest
|
||||
|
||||
renew-docs:
|
||||
name: Refresh pkg.go.dev
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Pull new module version
|
||||
uses: andrewslotin/go-proxy-pull-action@89382de145eeb7a85de72f8a27f686a50727bc7a #master@2022-10-14
|
||||
Loading…
Add table
Add a link
Reference in a new issue