Merge pull request #189 from rogy-AquaLab/release-fix2 #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
check-main-branch: | |
runs-on: ubuntu-latest | |
outputs: | |
contains: ${{ steps.check.outputs.contains }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- id: check | |
run: | | |
branches=$(git branch --contains "$GITHUB_REF_NAME") | |
for branch in $branches; do | |
if [[ "$branch" == "main" ]]; then | |
echo "contains=true" >> "$GITHUB_OUTPUT" | |
exit 0 | |
fi | |
done | |
echo "contains=false" >> "$GITHUB_OUTPUT" | |
build-book: | |
runs-on: ubuntu-latest | |
env: | |
# FIXME: duplicate of .github/workflows/main.yml:112 | |
MDBOOK_VERSION: v0.4.36 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- run: | | |
curl -fsSL "$REPO_URL$RELEASE_DL_PATH/$MDBOOK_VERSION/$FILENAME" | tar xz | |
env: | |
REPO_URL: https://github.com/rust-lang/mdBook | |
RELEASE_DL_PATH: /releases/download | |
FILENAME: mdbook-${{ env.MDBOOK_VERSION }}-x86_64-unknown-linux-gnu.tar.gz | |
- run: | | |
./mdbook build | |
tar czf book.tar.gz book | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: book-archive | |
path: ./book.tar.gz | |
create-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- check-main-branch | |
- build-book | |
if: ${{ needs.check-main-branch.outputs.contains == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: book-archive | |
- run: | | |
gh release create $GITHUB_REF_NAME book.tar.gz \ | |
-d -t $GITHUB_REF_NAME -n "" --verify-tag | |
env: | |
GH_TOKEN: ${{ github.token }} |