chore(ci): Stage releases until done

This commit is contained in:
Ed Page 2024-10-24 12:04:19 -05:00
parent 4ba8712927
commit 88ea8ea67d

View file

@ -19,40 +19,39 @@ on:
tags: tags:
- "v*.*.*" - "v*.*.*"
- "!varcon*" - "!varcon*"
env: env:
BIN_NAME: typos BIN_NAME: typos
# We need this to be able to create releases.
permissions:
contents: write
jobs: jobs:
create-release: create-release:
name: create-release name: create-release
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
upload_url: ${{ steps.release.outputs.upload_url }} version: ${{ env.TAG }}
release_version: ${{ env.RELEASE_VERSION }}
steps: steps:
- name: Get the release version from the tag
shell: bash
if: env.RELEASE_VERSION == ''
run: |
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Get the release version from the tag
if: env.TAG == ''
run: echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the tag
run: |
echo "tag is: $TAG"
- name: Generate Release Notes - name: Generate Release Notes
run: | run: |
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md ./.github/workflows/release-notes.py --tag ${{ env.TAG }} --output notes-${{ env.ERSION }}.md
cat notes-${{ env.RELEASE_VERSION }}.md cat notes-${{ env.TAG }}.md
- name: Create GitHub release - name: Create GitHub release
id: release
uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ github.token }}
with: run: gh release create $TAG --verify-tag --draft --title $TAG --notes-file notes-${{ env.TAG }}.md
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
body_path: notes-${{ env.RELEASE_VERSION }}.md
build-release: build-release:
name: build-release name: build-release
needs: create-release needs: create-release
@ -99,7 +98,7 @@ jobs:
shell: bash shell: bash
run: | run: |
outdir="./target/${{ matrix.target }}/release" outdir="./target/${{ matrix.target }}/release"
staging="${{ env.BIN_NAME }}-${{ needs.create-release.outputs.release_version }}-${{ matrix.target }}" staging="${{ env.BIN_NAME }}-${{ needs.create-release.outputs.tag }}-${{ matrix.target }}"
mkdir -p "$staging"/doc mkdir -p "$staging"/doc
cp {README.md,LICENSE-*} "$staging/" cp {README.md,LICENSE-*} "$staging/"
cp {CHANGELOG.md,docs/*} "$staging/doc/" cp {CHANGELOG.md,docs/*} "$staging/doc/"
@ -116,11 +115,18 @@ jobs:
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi fi
- name: Upload release archive - name: Upload release archive
uses: actions/upload-release-asset@v1.0.2
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ github.token }}
with: shell: bash
upload_url: ${{ needs.create-release.outputs.upload_url }} run: |
asset_path: ${{ env.ASSET }} tag="${{ needs.create-release.outputs.tag }}"
asset_name: ${{ env.ASSET }} gh release upload "$tag" ${{ env.ASSET }}
asset_content_type: application/octet-stream publish-release:
name: Publish Release
needs: [prepare-release, build-release]
runs-on: ubuntu-latest
steps:
- name: Publish Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release edit "${{ needs.create-release.outputs.tag }}" --draft=false