Fix CI script #2
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
name: "Release" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
workflow_dispatch: {} | |
jobs: | |
release: | |
name: "Package and release category" | |
# Skip CI if this is the template repository. | |
if: github.repository != 'RiverBench/category-template' | |
runs-on: "ubuntu-latest" | |
container: ghcr.io/riverbench/ci-worker:main | |
# Force only one package job to execute at a time, to avoid duplicating work. | |
concurrency: package-category | |
steps: | |
- name: "Checkout category repository" | |
uses: actions/checkout@v4 | |
with: | |
path: category | |
- name: Fetch the schema repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'RiverBench/schema' | |
path: schema | |
- name: Fetch the main repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'RiverBench/RiverBench' | |
path: main | |
- name: "Package the category" | |
run: | | |
mkdir package_out | |
ci-worker package-category "${GITHUB_REF_NAME#v}" category main schema package_out | |
mkdir release | |
mv package_out/tasks/*.* release/ | |
mv package_out/profiles/*.* release/ | |
mv package_out/category/metadata.* release/ | |
- name: "Generate documentation" | |
run: | | |
mkdir doc_out | |
ci-worker category-doc-gen package_out category schema doc_out | |
mv doc_out/category/README.md . || true | |
tar -czf release/docs.tar.gz -C doc_out . | |
- name: Upload the README artifact | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: readme | |
path: README.md | |
- name: Upload the pre-release | |
if: github.ref == 'refs/heads/main' | |
uses: RiverBench/[email protected] | |
with: | |
allowUpdates: true | |
prerelease: true | |
draft: false | |
makeLatest: false | |
tag: "dev" | |
name: "Development pre-release" | |
artifacts: 'release/*' | |
removeArtifacts: true | |
generateReleaseNotes: true | |
artifactErrorsFailBuild: true | |
- name: Upload the tagged release | |
if: github.ref != 'refs/heads/main' | |
uses: RiverBench/[email protected] | |
with: | |
prerelease: false | |
draft: false | |
makeLatest: true | |
tag: "${{ env.GITHUB_REF_NAME }}" | |
name: "${{ env.GITHUB_REF_NAME }}" | |
artifacts: 'release/*' | |
generateReleaseNotes: true | |
artifactErrorsFailBuild: true | |
update-readme: | |
needs: release | |
if: github.ref == 'refs/heads/main' | |
name: "Update README.md" | |
runs-on: "ubuntu-latest" | |
permissions: write-all | |
steps: | |
- name: "Checkout category repository" | |
uses: actions/checkout@v4 | |
- name: Restore README.md | |
uses: actions/download-artifact@v3 | |
with: | |
name: readme | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: 'Automatic update of README.md' | |
default_author: github_actions | |
add: 'README.md' | |
push: true | |