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

View File

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