chore: update plugin versions included in container image #566
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: | |
jobs: | |
test-unix: | |
name: Test Unix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21.x | |
- uses: actions/checkout@v3 | |
- name: Test | |
run: go test -race -coverprofile=cov -covermode=atomic -tags=githubci ./... | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./cov | |
test-windows: | |
name: Test Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21.x | |
- uses: actions/checkout@v3 | |
- name: Test | |
run: go test -coverprofile=cov -covermode=atomic -tags=githubci ./... | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./cov | |
analyze: | |
name: CodeQL | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: github/codeql-action/init@v2 | |
with: | |
languages: go | |
- uses: github/codeql-action/analyze@v2 | |
release: | |
name: Release Binary | |
needs: [test-unix, test-windows, analyze] | |
if: "contains(github.ref, 'tags/v')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21.x | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install upx-ucl | |
run: sudo apt install upx-ucl -y | |
- uses: goreleaser/goreleaser-action@v3 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
container: | |
name: Release Container | |
needs: [test-unix, test-windows, analyze] | |
if: "contains(github.ref, 'tags/v')" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
base: [scratch, alpine, ubuntu] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login GitHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate tags | |
id: tags | |
run: | | |
version="${GITHUB_REF##*/v}" | |
echo "version=${version}" >> $GITHUB_ENV | |
echo "short_commit=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "container_tags<<END_OF_TAGS" >> $GITHUB_ENV | |
for registry in "ghcr.io/${{ github.repository }}" "${{ github.repository }}"; do | |
if [ "${{ matrix.base }}" = "alpine" ]; then | |
echo "${registry}:latest" >> $GITHUB_ENV | |
echo "${registry}:${version}" >> $GITHUB_ENV | |
echo "${registry}:${version%.*}" >> $GITHUB_ENV | |
fi | |
echo "${registry}:${{ matrix.base }}" >> $GITHUB_ENV | |
echo "${registry}:${{ matrix.base }}-latest" >> $GITHUB_ENV | |
echo "${registry}:${{ matrix.base }}-${version}" >> $GITHUB_ENV | |
echo "${registry}:${{ matrix.base }}-${version%.*}" >> $GITHUB_ENV | |
done | |
echo "END_OF_TAGS" >> $GITHUB_ENV | |
echo "container_labels<<END_OF_LABELS" >> $GITHUB_ENV | |
echo "org.opencontainers.image.title=Ayd" >> $GITHUB_ENV | |
echo "org.opencontainers.image.description=The easiest alive monitoring tool." >> $GITHUB_ENV | |
echo "org.opencontainers.image.url=https://github.com/macrat/ayd" >> $GITHUB_ENV | |
echo "org.opencontainers.image.source=https://github.com/macrat/ayd" >> $GITHUB_ENV | |
echo "org.opencontainers.image.created=$(date +'%Y-%m-%dT%H:%M:%S%:z')" >> $GITHUB_ENV | |
echo "org.opencontainers.image.version=${version}" >> $GITHUB_ENV | |
echo "org.opencontainers.image.revision=${{ github.sha }}" >> $GITHUB_ENV | |
echo "org.opencontainers.image.licenses=MIT" >> $GITHUB_ENV | |
echo "END_OF_LABELS" >> $GITHUB_ENV | |
- uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ${{ env.container_tags }} | |
labels: ${{ env.container_labels }} | |
build-args: | | |
BASE_IMAGE=${{ matrix.base }} | |
VERSION=${{ env.version }} | |
COMMIT=${{ env.short_commit }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
cache-from: type=gha,scope=buildkit-${{ matrix.base }} | |
cache-to: type=gha,mode=max,scope=buildkit-${{ matrix.base }} |