Skip to content

Commit

Permalink
chore(ci): Stage releases until done
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 24, 2024
1 parent 4ba8712 commit 88ea8ea
Showing 1 changed file with 32 additions and 26 deletions.
58 changes: 32 additions & 26 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,39 @@ on:
tags:
- "v*.*.*"
- "!varcon*"

env:
BIN_NAME: typos

# We need this to be able to create releases.
permissions:
contents: write

jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
release_version: ${{ env.RELEASE_VERSION }}
version: ${{ env.TAG }}
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
uses: actions/checkout@v4
with:
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
run: |
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md
cat notes-${{ env.RELEASE_VERSION }}.md
./.github/workflows/release-notes.py --tag ${{ env.TAG }} --output notes-${{ env.ERSION }}.md
cat notes-${{ env.TAG }}.md
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
body_path: notes-${{ env.RELEASE_VERSION }}.md
GH_TOKEN: ${{ github.token }}
run: gh release create $TAG --verify-tag --draft --title $TAG --notes-file notes-${{ env.TAG }}.md
build-release:
name: build-release
needs: create-release
Expand Down Expand Up @@ -99,7 +98,7 @@ jobs:
shell: bash
run: |
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
cp {README.md,LICENSE-*} "$staging/"
cp {CHANGELOG.md,docs/*} "$staging/doc/"
Expand All @@ -116,11 +115,18 @@ jobs:
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Upload release archive
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
tag="${{ needs.create-release.outputs.tag }}"
gh release upload "$tag" ${{ env.ASSET }}
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

0 comments on commit 88ea8ea

Please sign in to comment.