2022-02-14 17:23:37 +01:00
|
|
|
### github action to make and publish a release
|
|
|
|
##
|
|
|
|
name: release
|
2022-02-13 20:17:04 +01:00
|
|
|
|
2022-02-14 17:23:37 +01:00
|
|
|
## Controls when the workflow will run
|
2022-02-13 20:17:04 +01:00
|
|
|
on:
|
2022-02-14 17:23:37 +01:00
|
|
|
## Triggers the workflow on push or pull request events but only for the master branch
|
2022-02-13 20:17:04 +01:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- "v*"
|
|
|
|
|
2022-02-14 17:23:37 +01:00
|
|
|
## A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
2022-02-13 20:17:04 +01:00
|
|
|
jobs:
|
2022-04-01 21:36:25 +02:00
|
|
|
create_package:
|
|
|
|
name: "create a TeX Live package for tikz-trackschematic"
|
2022-04-05 14:28:09 +02:00
|
|
|
outputs:
|
|
|
|
version: ${{ steps.tag.outputs.tag }}
|
2022-02-14 14:27:22 +01:00
|
|
|
runs-on: ubuntu-latest
|
2022-02-13 20:17:04 +01:00
|
|
|
steps:
|
2022-04-05 14:28:09 +02:00
|
|
|
# 1. get varibale tag and put it in ${{ steps.tag.outputs.tag }}
|
|
|
|
- name: "get tag"
|
|
|
|
id: tag
|
|
|
|
uses: dawidd6/action-get-tag@v1
|
|
|
|
with:
|
|
|
|
# Optionally strip `v` prefix
|
|
|
|
strip_v: false
|
|
|
|
|
|
|
|
# 2. checkout the repo
|
2022-02-13 20:17:04 +01:00
|
|
|
- name: "checkout"
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2022-04-05 14:28:09 +02:00
|
|
|
# 3. install TeX Live
|
2022-03-24 14:58:28 +01:00
|
|
|
- name: "install ghostscript"
|
|
|
|
run: sudo apt-get install -y ghostscript
|
|
|
|
|
|
|
|
- name: "setup TeX Live (via paolobrasolin)"
|
|
|
|
uses: paolobrasolin/setup-texlive-action@v1
|
|
|
|
with:
|
|
|
|
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
|
|
|
|
packages-path: ${{ github.workspace }}/.github/tex/packages.doc.txt
|
|
|
|
|
2022-04-05 14:28:09 +02:00
|
|
|
# 4. (re-)compile the documentation
|
2022-03-24 14:58:28 +01:00
|
|
|
- name: "update tikz-trackschematic documentation before release"
|
|
|
|
run: ./build.sh --non-interactive --memory-increase --compile-doc
|
|
|
|
|
2022-04-01 21:36:25 +02:00
|
|
|
# 5. create package and release notes
|
2022-02-13 20:17:04 +01:00
|
|
|
- name: "create tikz-trackschematic package"
|
2022-03-10 15:41:17 +01:00
|
|
|
run: ./build.sh --non-interactive --release ${{ steps.tag.outputs.tag }}
|
2022-04-01 21:36:25 +02:00
|
|
|
|
|
|
|
# 6. upload artifact to share it with other jobs
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-04-05 14:28:09 +02:00
|
|
|
path: |
|
|
|
|
tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
|
|
|
|
release-note-${{ steps.tag.outputs.tag }}.md
|
2022-04-01 21:36:25 +02:00
|
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
path: .github/tex/tikz-trackschematic.pkg
|
2022-04-05 14:28:09 +02:00
|
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
2022-04-01 21:36:25 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
path: .github/zenodo/metadata.json
|
2022-04-05 14:28:09 +02:00
|
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
2022-04-01 21:36:25 +02:00
|
|
|
|
|
|
|
publish_github:
|
|
|
|
needs: create_package
|
|
|
|
name: "publish on github"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-04 11:01:51 +02:00
|
|
|
# 1. download artifact in folder artifact/
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
|
2022-04-05 14:28:09 +02:00
|
|
|
# 2. creating a new release
|
2022-02-13 20:17:04 +01:00
|
|
|
- name: "create release"
|
|
|
|
id: create_release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: Release ${{ github.ref }}
|
2022-04-05 14:28:09 +02:00
|
|
|
body_path: artifact/release-note-${{needs.create_package.outputs.version}}.md
|
2022-02-13 20:17:04 +01:00
|
|
|
draft: false
|
|
|
|
prerelease: false
|
2022-04-05 14:28:09 +02:00
|
|
|
|
|
|
|
# 3. upload package to new release
|
2022-02-13 20:17:04 +01:00
|
|
|
- name: "upload release asset"
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2022-04-05 14:28:09 +02:00
|
|
|
asset_path: artifact/tikz-trackschematic-${{needs.create_package.outputs.version}}.zip
|
|
|
|
asset_name: tikz-trackschematic-${{needs.create_package.outputs.version}}.zip
|
2022-02-13 20:17:04 +01:00
|
|
|
asset_content_type: application/zip
|
|
|
|
|
2022-04-05 14:28:09 +02:00
|
|
|
# 4. publish release on github
|
2022-02-13 20:17:04 +01:00
|
|
|
- name: "publish release"
|
|
|
|
uses: StuYarrow/publish-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
id: ${{ steps.create_release.outputs.id }}
|
2022-03-24 14:58:28 +01:00
|
|
|
|
2022-04-01 21:36:25 +02:00
|
|
|
publish_CTAN:
|
|
|
|
needs: create_package
|
|
|
|
name: "publish on CTAN"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-05 14:28:09 +02:00
|
|
|
# 1. download artifact in folder artifact/ and move it one level up
|
2022-04-01 21:36:25 +02:00
|
|
|
- uses: actions/download-artifact@v3
|
2022-04-04 11:01:51 +02:00
|
|
|
- run: |
|
2022-04-06 17:16:28 +02:00
|
|
|
mv ./artifact/tikz-trackschematic-${{needs.create_package.outputs.version}}.zip ./
|
2022-04-01 21:36:25 +02:00
|
|
|
|
|
|
|
# 2. install ctan-o-mat
|
|
|
|
- name: "setup TeX Live (via paolobrasolin)"
|
|
|
|
uses: paolobrasolin/setup-texlive-action@v1
|
|
|
|
with:
|
|
|
|
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
|
|
|
|
packages-path: ${{ github.workspace }}/.github/tex/packages.upload.txt
|
|
|
|
|
|
|
|
# 3. upload new release to CTAN
|
2022-03-29 23:55:43 +02:00
|
|
|
- name: CTAN submit
|
2022-04-05 14:28:09 +02:00
|
|
|
run: ctan-o-mat --verbose --submit artifact/tikz-trackschematic.pkg
|
2022-04-04 11:01:51 +02:00
|
|
|
|
|
|
|
publish_zenodo:
|
|
|
|
needs: create_package
|
2022-04-05 14:28:09 +02:00
|
|
|
name: "publish on zenodo"
|
|
|
|
outputs:
|
|
|
|
doi: ${{ steps.zenodraft.outputs.doi }}
|
2022-04-04 11:01:51 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-05 14:28:09 +02:00
|
|
|
# 1. download artifact in folder artifact/ and move it one level up
|
2022-04-04 11:01:51 +02:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
- run: |
|
|
|
|
mv ./artifact/tikz-trackschematic-*.zip ./
|
|
|
|
|
2022-04-05 14:28:09 +02:00
|
|
|
# 2. install zenodraft
|
|
|
|
- name: "install zenodraft"
|
|
|
|
run: npm install -g zenodraft
|
|
|
|
|
|
|
|
# 3. upload new release to zenodo
|
|
|
|
- name: "uploading to zenodo"
|
|
|
|
id: zenodraft
|
2022-04-04 11:01:51 +02:00
|
|
|
env:
|
|
|
|
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
|
2022-04-05 14:28:09 +02:00
|
|
|
COLLECTION: 5539844
|
|
|
|
run: |
|
|
|
|
ID=$(zenodraft deposition create in-existing-collection $COLLECTION)
|
|
|
|
zenodraft file add $ID tikz-trackschematic-*.zip
|
|
|
|
zenodraft metadata update $ID artifact/metadata.json
|
|
|
|
zenodraft deposition publish $ID
|
|
|
|
echo "::set-output name=doi::$(zenodraft deposition show prereserved $ID)"
|
|
|
|
|
|
|
|
update_citation:
|
|
|
|
needs: publish_zenodo
|
|
|
|
name: "updates CITATION.cff"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-06 17:16:28 +02:00
|
|
|
# 1. checkout the repo
|
2022-04-05 14:28:09 +02:00
|
|
|
- name: "checkout"
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2022-04-06 17:16:28 +02:00
|
|
|
# 2. update CITATION.cff
|
2022-04-05 14:28:09 +02:00
|
|
|
- run: ./build.sh --update-cite ${{needs.publish_zenodo.outputs.doi}}
|
|
|
|
|
2022-04-06 17:16:28 +02:00
|
|
|
# 3. push the change back to master
|
2022-04-05 14:28:09 +02:00
|
|
|
- name: push
|
|
|
|
uses: github-actions-x/commit@v2.8
|
2022-04-04 11:01:51 +02:00
|
|
|
with:
|
2022-04-05 14:28:09 +02:00
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
push-branch: 'master'
|
|
|
|
force-add: 'true'
|
|
|
|
files: CITATION.cff
|
|
|
|
commit-message: 'updated DOI (via github action)'
|
2022-04-06 17:16:28 +02:00
|
|
|
name: Martin Scheidt
|
|
|
|
email: m.scheidt@tu-bs.de
|