Skip to content

Merge pull request #776 from cybozu-go/bump-1.30.1 #102

Merge pull request #776 from cybozu-go/bump-1.30.1

Merge pull request #776 from cybozu-go/bump-1.30.1 #102

Workflow file for this run

name: release
on:
push:
tags:
- 'v*'
env:
prerelease: ${{ contains(github.ref, '-') }}
jobs:
sonobuoy:
name: Run sonobuoy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.NECO_TEST_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
- name: Set GCP instance name
run: echo "INSTANCE_NAME=cke-${{ matrix.suite }}-${{ github.run_number }}-$(TZ=Asia/Tokyo date +%H%M%S)" >> $GITHUB_ENV
- name: Run sonobuoy
run: |
if [ ${{ github.event_name }} = "pull_request" ]; then
GITHUB_SHA=$(cat ${GITHUB_EVENT_PATH} | jq -r '.pull_request.head.sha')
fi
./bin/run-sonobuoy.sh
timeout-minutes: 240
- name: Check failures
run: |
grep -F 'no tests failed for plugin "e2e" in tarball' /tmp/e2e-check.log
- name: Upload sonobuoy test result
uses: actions/upload-artifact@v4
with:
name: sonobuoy-test
path: /tmp/sonobuoy.tar.gz
retention-days: 1
release-cke-image:
name: Release CKE Image
needs: sonobuoy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make install GOBIN=$(pwd)/docker
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=false
images: |
ghcr.io/${{ github.repository_owner }}/cke
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}},enable=${{ env.prerelease == 'false' }}
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push cke
uses: docker/build-push-action@v5
with:
context: ./docker
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release-github:
name: Release on GitHub
runs-on: ubuntu-22.04
needs: release-cke-image
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download sonobuoy test
uses: actions/download-artifact@v4
with:
name: sonobuoy-test
- name: Extract tag
id: extract-tag
run: echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Prepare files
run: |
mkdir /tmp/upload
cp ./sonobuoy.tar.gz /tmp/upload
tar xzf ./sonobuoy.tar.gz -C /tmp/upload --strip-components=4 plugins/e2e/results/global/e2e.log plugins/e2e/results/global/junit_01.xml
sed "s/vX\.Y\.Z/v${{ steps.extract-tag.outputs.tag }}/" sonobuoy/README.md > /tmp/upload/README.md
sed "s/vX\.Y\.Z/v${{ steps.extract-tag.outputs.tag }}/" sonobuoy/PRODUCT.yaml > /tmp/upload/PRODUCT.yaml
GOBIN=/tmp/upload CGO_ENABLED=0 go install -buildvcs=false ./pkg/cke ./pkg/ckecli
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ${{ env.prerelease }}; then
PRERELEASE="--prerelease"
fi
gh release create v${{ steps.extract-tag.outputs.tag }} ${PRERELEASE} -t v${{ steps.extract-tag.outputs.tag }} -n "See [CHANGELOG.md](./CHANGELOG.md) for details." /tmp/upload/*