Separate test and release workflows. #22
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
on: | ||
push: | ||
branches: | ||
- main | ||
- "release/**" | ||
tags: | ||
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
pull_request: | ||
branches: | ||
- main | ||
- "release/**" | ||
name: Release | ||
env: | ||
GO_VERSION: "1.21.0" | ||
BINARY_ARTIFACT_NAME: "windows-cni-binaries" | ||
RELEASE_NOTES_ARTIFACT_NAME: "windows-cni-release-notes" | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
name: Crossbuild Binary Release | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
version: ${{ steps.getrelease.outputs.version }} | ||
binaries_artifact: ${{ env.BINARY_ARTIFACT_NAME }}-${{ steps.getrelease.outputs.version }} | ||
release_notes_artifact: ${{ env.BINARY_ARTIFACT_NAME }}-${{ steps.getrelease.outputs.version }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
path: src/github.com/Microsoft/windows-container-networking | ||
- name: Get release version | ||
id: getrelease | ||
run: | | ||
ref=${{ github.ref }} | ||
version="${RELEASEVER#refs/tags/v}" | ||
# If we can't extract the version from the tag, use the commit ID. | ||
if [ "$ref" = "$version" ]; then | ||
version=$(git show -s --format=%H | cut -c -12) | ||
fi | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
working-directory: src/github.com/Microsoft/windows-container-networking | ||
- name: Check unsigned tag | ||
run: | | ||
releasever="${{ steps.getrelease.outputs.version }}" | ||
TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) || | ||
echo "${TAGCHECK}" | grep -q "error" && { | ||
echo "::warning::tag ${releasever} is not a signed tag!" | ||
} || { | ||
echo "Tag ${releasever} is signed." | ||
} | ||
working-directory: src/github.com/Microsoft/windows-container-networking | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Make binary release | ||
shell: bash | ||
run: | | ||
make release "VERSION=${RELEASE_VER}" | ||
working-directory: src/github.com/Microsoft/windows-container-networking | ||
- name: Make release notes | ||
run: | | ||
version="${{ steps.getrelease.outputs.version }}" | ||
git tag -l ${version#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md | ||
working-directory: src/github.com/Microsoft/windows-container-networking | ||
- name: Upload release notes | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.RELEASE_NOTES_ARTIFACT_NAME }}-${{ steps.getrelease.outputs.version }} | ||
path: src/github.com/Microsoft/windows-container-networking/release-notes.md | ||
- name: Upload binary release | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.BINARY_ARTIFACT_NAME }}-${{ steps.getrelease.outputs.version }} | ||
path: src/github.com/Microsoft/windows-container-networking/release/* | ||
test: | ||
# NOTE(aznashwan, 11/24/21): GitHub actions do not currently support referencing | ||
# or evaluating any kind of variables in the `uses` clause, but this will | ||
# ideally be added in the future in which case the hardcoded reference to the | ||
# upstream containerd repository should be replaced with the following to | ||
# potentially allow contributors to enable periodic Windows tests on forks as well: | ||
# uses: "${{ github.repository }}/.github/workflows/windows-periodic.yml@${{ github.ref_name }}" | ||
# HACK(aznashwan): replaced workflow owner from 'Microsoft' for testing. | ||
# uses: "Microsoft/windows-container-networking/.github/workflows/ci.yml@master" | ||
uses: "aznashwan/windows-container-networking/.github/workflows/ci.yml@master" | ||
Check failure on line 100 in .github/workflows/release.yml GitHub Actions / .github/workflows/release.ymlInvalid workflow file
|
||
release: | ||
name: Create CNI Binaries Release | ||
needs: [build, test] | ||
# NOTE: only release on pushes to release tags: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Download builds and release notes | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: builds | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fail_on_unmatched_files: true | ||
name: windows-cni ${{ needs.build.outputs.version }} | ||
draft: false | ||
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }} | ||
body_path: ./builds/${{ needs.build.outputs.release_notes_artifact }}/release-notes.md | ||
files: | | ||
builds/${{ needs.build.outputs.binaries_artifact }}/* |