2022-06-02 09:10:17 +00:00
|
|
|
# How we deploy a release. Covers binary builds. Also manages packaging for choco.
|
2020-11-26 08:28:56 +00:00
|
|
|
#
|
2021-07-19 05:30:52 +00:00
|
|
|
# Based on https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml
|
2020-11-21 20:31:19 +00:00
|
|
|
|
|
|
|
name: deployment
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2020-11-26 08:28:56 +00:00
|
|
|
inputs:
|
|
|
|
tag:
|
2021-01-31 19:19:07 +00:00
|
|
|
description: "Which tag to deploy as:"
|
2020-11-26 08:28:56 +00:00
|
|
|
required: true
|
2020-11-22 09:18:47 +00:00
|
|
|
push:
|
2020-11-21 20:31:19 +00:00
|
|
|
tags:
|
2020-11-22 09:18:47 +00:00
|
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
2020-11-21 20:31:19 +00:00
|
|
|
|
2022-04-29 22:15:49 +00:00
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
CARGO_PROFILE_DEV_DEBUG: 0
|
|
|
|
|
2020-11-21 20:31:19 +00:00
|
|
|
jobs:
|
2021-10-09 06:29:17 +00:00
|
|
|
initialize-release-job:
|
|
|
|
name: initialize-release-job
|
2020-11-21 20:31:19 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Get the release version from the tag
|
|
|
|
if: env.VERSION == ''
|
|
|
|
run: |
|
2020-11-26 08:28:56 +00:00
|
|
|
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
|
2020-11-22 17:40:29 +00:00
|
|
|
run: |
|
2020-11-26 08:28:56 +00:00
|
|
|
echo "Version being built against is version ${{ env.VERSION }}"!
|
2020-11-22 09:18:47 +00:00
|
|
|
|
2020-11-21 20:31:19 +00:00
|
|
|
- name: Save version number to artifact
|
2021-10-09 06:29:17 +00:00
|
|
|
run: echo "${{ env.VERSION }}" > release-version
|
2020-11-21 20:31:19 +00:00
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
- name: Upload release-version as artifact
|
2022-11-11 07:48:25 +00:00
|
|
|
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
|
2020-11-21 20:31:19 +00:00
|
|
|
with:
|
2021-10-09 06:29:17 +00:00
|
|
|
retention-days: 3
|
|
|
|
name: release-version
|
|
|
|
path: release-version
|
2020-11-21 20:31:19 +00:00
|
|
|
|
|
|
|
build-release:
|
2021-10-09 06:29:17 +00:00
|
|
|
needs: [initialize-release-job]
|
2022-06-02 09:10:17 +00:00
|
|
|
uses: ./.github/workflows/build_releases.yml
|
2022-10-27 10:27:04 +00:00
|
|
|
with:
|
|
|
|
caller: "deployment"
|
|
|
|
secrets: inherit
|
2020-11-21 20:31:19 +00:00
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
generate-choco:
|
2020-11-26 05:07:38 +00:00
|
|
|
needs: [build-release]
|
2022-06-02 09:10:17 +00:00
|
|
|
name: "Generate Chocolatey files"
|
2020-11-26 05:07:38 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-06-02 19:05:43 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-11-26 05:07:38 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
- name: Get release version
|
2022-06-02 09:10:17 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2020-11-26 05:07:38 +00:00
|
|
|
with:
|
2021-10-09 06:29:17 +00:00
|
|
|
name: release-version
|
|
|
|
path: release-version
|
2020-11-26 05:07:38 +00:00
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
- name: Set release version
|
2020-11-26 05:07:38 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-10-09 06:29:17 +00:00
|
|
|
release_version="$(cat ./release-version/release-version)"
|
2020-11-26 05:07:38 +00:00
|
|
|
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
- name: Validate release version
|
2020-11-26 05:07:38 +00:00
|
|
|
run: |
|
2020-11-26 08:28:56 +00:00
|
|
|
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
2020-11-26 05:07:38 +00:00
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
- name: Get release artifacts
|
2022-06-02 09:10:17 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-10-09 06:29:17 +00:00
|
|
|
with:
|
|
|
|
name: release
|
|
|
|
path: release
|
|
|
|
|
2020-11-26 05:07:38 +00:00
|
|
|
- name: Execute choco packaging script
|
|
|
|
run: |
|
2022-11-06 08:19:52 +00:00
|
|
|
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/"
|
2020-11-26 05:07:38 +00:00
|
|
|
zip -r choco.zip "bottom.nuspec" "tools"
|
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
- name: Move release file into release directory
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mv choco.zip release/
|
|
|
|
|
|
|
|
- name: Save release as artifact
|
2022-11-11 07:48:25 +00:00
|
|
|
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
|
2021-10-09 06:29:17 +00:00
|
|
|
with:
|
|
|
|
retention-days: 3
|
|
|
|
name: release
|
|
|
|
path: release
|
|
|
|
|
|
|
|
upload-release:
|
|
|
|
name: upload-release
|
|
|
|
runs-on: ubuntu-latest
|
2022-06-02 09:10:17 +00:00
|
|
|
needs: [generate-choco, build-release]
|
2021-10-09 06:29:17 +00:00
|
|
|
steps:
|
|
|
|
- name: Get release version
|
2022-06-02 09:10:17 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-10-09 06:29:17 +00:00
|
|
|
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
|
2022-06-02 09:10:17 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2021-10-09 06:29:17 +00:00
|
|
|
with:
|
|
|
|
name: release
|
|
|
|
path: release
|
|
|
|
|
|
|
|
- name: Print out all release files
|
|
|
|
run: |
|
|
|
|
echo "Generated $(ls ./release | wc -l) files:"
|
2022-05-18 23:09:50 +00:00
|
|
|
du -h -d 0 ./release/*
|
2021-10-09 06:29:17 +00:00
|
|
|
|
|
|
|
- name: Upload all saved release files
|
2023-01-01 05:23:11 +00:00
|
|
|
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # 0.1.15
|
2020-11-26 05:07:38 +00:00
|
|
|
with:
|
2021-10-09 06:29:17 +00:00
|
|
|
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 -->
|
2021-12-19 18:56:54 +00:00
|
|
|
|
2021-10-09 06:29:17 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
## Changes
|
|
|
|
|
|
|
|
## Bug Fixes
|
|
|
|
|
|
|
|
## Internal Changes
|
|
|
|
files: |
|
|
|
|
./release/*
|