bottom/.github/workflows/deployment.yml
Clement Tsang fc90c549ef
ci: update GitHub CI to remove deprecated/unmaintained actions and commands (#846)
* ci: update rust-cache to 2.0.1

* ci: update dtolnay/rust-toolchain to ba37adf

* ci: update skip-duplicate-actions to v5.2.0

* ci: update ClementTsang/cargo-action to v0.0.3

* ci: update to macos-12

* ci: update ghaction-chocolatey to 2.1.0

* ci: update upload-artifact to v3.1.0

* ci: change from actions-rs to rustsec for audit-check

* ci: stop using actions-rs for builds

* ci: update cirrus to use tlsv1.2 when curling

* ci: disable macOS ARM workflows on GHA since its built on Cirrus
2022-10-20 06:24:04 -04:00

157 lines
4.5 KiB
YAML

# How we deploy a release. Covers binary builds. Also manages packaging for choco.
#
# Based on https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml
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
jobs:
initialize-release-job:
name: initialize-release-job
runs-on: ubuntu-latest
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 }}"!
- name: Save version number to artifact
run: echo "${{ env.VERSION }}" > release-version
- name: Upload release-version as artifact
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
retention-days: 3
name: release-version
path: release-version
build-release:
needs: [initialize-release-job]
uses: ./.github/workflows/build_releases.yml
generate-choco:
needs: [build-release]
name: "Generate Chocolatey files"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Get release version
uses: actions/download-artifact@v3
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
- name: Validate release version
run: |
echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Get release artifacts
uses: actions/download-artifact@v3
with:
name: release
path: release
- name: Execute choco packaging script
run: |
python "./deployment/windows/choco/choco_packager.py" "./release/bottom_x86_64-pc-windows-msvc.zip" ${{ env.RELEASE_VERSION }} "./deployment/windows/choco/bottom.nuspec.template" "./deployment/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@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
retention-days: 3
name: release
path: release
upload-release:
name: upload-release
runs-on: ubuntu-latest
needs: [generate-choco, build-release]
steps:
- name: Get release version
uses: actions/download-artifact@v3
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
- name: Validate release version
run: |
echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Get release artifacts
uses: actions/download-artifact@v3
with:
name: release
path: release
- name: Print out all release files
run: |
echo "Generated $(ls ./release | wc -l) files:"
du -h -d 0 ./release/*
- name: Upload all saved release files
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a # 0.1.14
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 -->
---
## Features
## Changes
## Bug Fixes
## Internal Changes
files: |
./release/*