ci: clean + fix post-release and deployment actions (#1224)

This commit is contained in:
Clement Tsang 2023-06-25 17:35:39 -04:00 committed by GitHub
parent 590b15a510
commit 6ee810f007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 68 deletions

View file

@ -20,9 +20,11 @@ env:
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
jobs:
initialize-release-job:
name: initialize-release-job
initialize:
name: initialize
runs-on: ubuntu-latest
outputs:
version: ${{ env.VERSION }}
steps:
- name: Get the release version from the tag
if: env.VERSION == ''
@ -38,25 +40,15 @@ jobs:
run: |
echo "Version being built against is version ${{ env.VERSION }}"!
- name: Save version number to artifact
run: echo "${{ env.VERSION }}" > release-version
- name: Upload release-version as artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
retention-days: 3
name: release-version
path: release-version
build-release:
needs: [initialize-release-job]
needs: [initialize]
uses: ./.github/workflows/build_releases.yml
with:
caller: "deployment"
secrets: inherit
generate-choco:
needs: [build-release]
needs: [initialize, build-release]
name: "Generate Chocolatey files"
runs-on: ubuntu-latest
steps:
@ -65,17 +57,10 @@ jobs:
with:
fetch-depth: 1
- name: Get release version
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: release-version
path: release-version
- name: Set release version
shell: bash
run: |
release_version="$(cat ./release-version/release-version)"
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
echo "RELEASE_VERSION=${{ needs.initialize.outputs.version }}" >> $GITHUB_ENV
- name: Validate release version
run: |
@ -107,19 +92,12 @@ jobs:
upload-release:
name: upload-release
runs-on: ubuntu-latest
needs: [generate-choco, build-release]
needs: [initialize, generate-choco, build-release]
steps:
- name: Get release version
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: release-version
path: release-version
- name: Set release version
shell: bash
run: |
release_version="$(cat ./release-version/release-version)"
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
echo "RELEASE_VERSION=${{ needs.initialize.outputs.version }}" >> $GITHUB_ENV
- name: Validate release version
run: |

View file

@ -8,6 +8,11 @@ name: post-release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Which tag to deploy as:"
required: true
env:
# Assign commit authorship to official Github Actions bot when pushing to the `gh-pages` branch:
@ -15,29 +20,50 @@ env:
GIT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
jobs:
initialize:
name: initialize
runs-on: ubuntu-latest
outputs:
version: ${{ env.VERSION }}
steps:
- name: Get the release version from the tag
if: env.VERSION == ''
run: |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
echo "Manual run against a tag; overriding actual tag in the environment..."
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
fi
- name: Test env
run: |
echo ${{ env.VERSION }}
- name: Make sure you're not on master/main/nightly
run: |
if [[ ${{ env.VERSION }} == "master" || ${{ env.VERSION }} == "main" || ${{ env.VERSION }} == "nightly" ]]; then
exit 1
fi
docs:
needs: [initialize]
runs-on: ubuntu-latest
steps:
- name: Set release version
shell: bash
run: |
echo "RELEASE_VERSION=${{ needs.initialize.outputs.version }}" >> $GITHUB_ENV
- name: Validate release version
run: |
echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- name: Set env
run: |
export RELEASE_VERSION=${{ github.event.release.tag_name }}
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Test env
run: |
echo $RELEASE_VERSION
- name: Make sure you're not on master/main/nightly...
run: |
if [[ $RELEASE_VERSION == "master" || $RELEASE_VERSION == "main" || $RELEASE_VERSION == "nightly" ]]; then
exit 1
fi
- uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
with:
python-version: 3.11
@ -62,24 +88,17 @@ jobs:
mike retitle --push ${RELEASE_VERSION} "${RELEASE_VERSION} (stable)"
chocolatey:
needs: [initialize]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Test env
- name: Set release version
shell: bash
run: |
echo $RELEASE_VERSION
echo "RELEASE_VERSION=${{ needs.initialize.outputs.version }}" >> $GITHUB_ENV
- name: Make sure you're not on master/main/nightly...
- name: Validate release version
run: |
if [[ $RELEASE_VERSION == "master" || $RELEASE_VERSION == "main" || $RELEASE_VERSION == "nightly" ]]; then
exit 1
fi
echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Trigger choco
run: |
curl -X POST https://api.github.com/repos/ClementTsang/choco-bottom/dispatches \
@ -88,23 +107,21 @@ jobs:
--data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }'
winget:
needs: [initialize]
runs-on: windows-latest
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Test env
- name: Set release version
shell: bash
run: |
echo $RELEASE_VERSION
echo "RELEASE_VERSION=${{ needs.initialize.outputs.version }}" >> $GITHUB_ENV
- name: Make sure you're not on master/main/nightly...
- name: Validate release version
run: |
if [[ $RELEASE_VERSION == "master" || $RELEASE_VERSION == "main" || $RELEASE_VERSION == "nightly" ]]; then
exit 1
fi
echo "Release version: ${{ env.RELEASE_VERSION }}"
- uses: vedantmgoyal2009/winget-releaser@79853c0938cc9946c1ec3cdd1b2e761bb0372b8c # v2
with:
identifier: Package.Identifier
installers-regex: '^bottom_x86_64_installer\.msi$'
token: ${{ secrets.WINGET_TOKEN }}
version: ${{ env.RELEASE_VERSION }}