mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-22 12:13:06 +00:00
c63574dc78
* deps: bump some CI actions as of 2024-09-01 * missed one
144 lines
4.2 KiB
YAML
144 lines
4.2 KiB
YAML
# How we deploy a release. Covers binary builds. Also manages packaging for choco.
|
|
#
|
|
# Binaries are primarily built by GHA, though some Linux, M1 macOS, and FreeBSD builds are
|
|
# handled by CirrusCI.
|
|
|
|
name: deployment
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Which tag to deploy as:"
|
|
required: true
|
|
push:
|
|
tags:
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
|
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_PROFILE_DEV_DEBUG: 0
|
|
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
|
|
|
|
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_REF#refs/tags/}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Validate version environment variable
|
|
run: |
|
|
echo "Version being built against is version ${{ env.VERSION }}"!
|
|
|
|
build-release:
|
|
needs: [initialize]
|
|
uses: ./.github/workflows/build_releases.yml
|
|
with:
|
|
caller: "deployment"
|
|
secrets: inherit
|
|
|
|
generate-choco:
|
|
needs: [initialize, build-release]
|
|
name: "Generate Chocolatey files"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- 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: Get release artifacts
|
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
pattern: release-*
|
|
path: release
|
|
merge-multiple: true
|
|
|
|
- name: Execute choco packaging script
|
|
run: |
|
|
python "./scripts/windows/choco/choco_packager.py" "./release/bottom_x86_64-pc-windows-msvc.zip" ${{ env.RELEASE_VERSION }} "./scripts/windows/choco/bottom.nuspec.template" "./scripts/windows/choco/chocolateyinstall.ps1.template" "bottom.nuspec" "tools/chocolateyinstall.ps1" "tools/"
|
|
zip -r choco.zip "bottom.nuspec" "tools"
|
|
|
|
- name: Move release file into release directory
|
|
shell: bash
|
|
run: |
|
|
mv choco.zip release/
|
|
|
|
- name: Save release as artifact
|
|
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
|
with:
|
|
retention-days: 3
|
|
name: release-choco
|
|
path: release
|
|
|
|
upload-release:
|
|
name: upload-release
|
|
runs-on: ubuntu-latest
|
|
needs: [initialize, generate-choco, build-release]
|
|
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: Get release artifacts
|
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
pattern: release-*
|
|
path: release
|
|
merge-multiple: true
|
|
|
|
- name: Print out all release files
|
|
run: |
|
|
echo "Generated $(ls ./release | wc -l) files:"
|
|
du -h -d 0 ./release/*
|
|
|
|
- name: Create release and add release files
|
|
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # 2.0.8
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
prerelease: false
|
|
tag_name: ${{ env.RELEASE_VERSION }}
|
|
draft: true
|
|
fail_on_unmatched_files: true
|
|
name: ${{ env.RELEASE_VERSION }} Release
|
|
body: |
|
|
<!-- Write summary here -->
|
|
|
|
---
|
|
|
|
## Bug Fixes
|
|
|
|
## Features
|
|
|
|
## Changes
|
|
|
|
## Other
|
|
|
|
## Internal Changes
|
|
files: |
|
|
./release/*
|