Merge pull request #144 from aleofreddi/master #236
Workflow file for this run
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: | | |
Build, test, push | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Get version number | |
run: | | |
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then | |
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
else | |
echo "VERSION=latest" >> $GITHUB_ENV | |
fi | |
- name: Test | |
run: | | |
curl -Ls https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.8.0/kubebuilder_linux_amd64 -o /var/tmp/kubebuilder | |
chmod +x /var/tmp/kubebuilder | |
sudo mv /var/tmp/kubebuilder /usr/local/bin/ | |
make test | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
docker login ghcr.io -u token --password-stdin <<< ${{ github.token }} | |
- name: Build and release image | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
export RELEASE_IMG=$(echo ghcr.io/${GITHUB_REPOSITORY}/gke-autoneg-controller | tr '[:upper:]' '[:lower:]') | |
export LABELS="--label org.opencontainers.image.licenses='Apache-2.0' --label org.opencontainers.image.revision='$BUILD_REVISION' --label org.opencontainers.image.source='${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}' --label org.opencontainers.image.title='${GITHUB_REPOSITORY#*/}' --label org.opencontainers.image.vendor='Google LLC' --label org.opencontainers.image.version='$VERSION'" | |
make release-push |