From ae8ed95aee8dbf232e2b920593ce2078c4063ae0 Mon Sep 17 00:00:00 2001 From: Martin Scheidt Date: Fri, 1 Apr 2022 21:36:25 +0200 Subject: [PATCH] restructured github actions --- .github/tex/packages.doc.txt | 1 - .github/tex/packages.upload.txt | 2 + .github/workflows/debug.yml | 51 +++++++++++++++++++---- .github/workflows/release.yaml | 71 +++++++++++++++++++++++++++----- .github/workflows/testing.yml | 2 +- .github/workflows/zenodo.yaml | 72 +++++++++++++++++++++++++++++++++ .github/zenodo/metadata.json | 30 ++++++++++++++ README.md | 2 +- build.sh | 12 ++++++ 9 files changed, 224 insertions(+), 19 deletions(-) create mode 100644 .github/tex/packages.upload.txt create mode 100644 .github/workflows/zenodo.yaml create mode 100644 .github/zenodo/metadata.json diff --git a/.github/tex/packages.doc.txt b/.github/tex/packages.doc.txt index 2b97eec..33e5ff2 100644 --- a/.github/tex/packages.doc.txt +++ b/.github/tex/packages.doc.txt @@ -1,7 +1,6 @@ ## -- engine used to compile (pdflatex) latex-bin latexmk -ctan-o-mat ## -- direct dependencies tikz-trackschematic diff --git a/.github/tex/packages.upload.txt b/.github/tex/packages.upload.txt new file mode 100644 index 0000000..a381916 --- /dev/null +++ b/.github/tex/packages.upload.txt @@ -0,0 +1,2 @@ +## -- upload +ctan-o-mat diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index aeff697..c1a4218 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -12,8 +12,42 @@ on: ## A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: + create_package: + name: "create a TeX Live package" + runs-on: ubuntu-latest + steps: + # checkout the repo + - name: "checkout" + uses: actions/checkout@v2 + + # create package and release notes + - name: "create tikz-trackschematic package" + run: ./build.sh --non-interactive --release v0.7.0 + + # upload artifact two share it with other jobs + - uses: actions/upload-artifact@v3 + with: + path: tikz-trackschematic-v0.7.0.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: release-note-v0.7.0.md + if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: .github/tex/tikz-trackschematic.pkg + if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: .github/zenodo/metadata.json + if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` + # This workflow contains a single job called "build" debug: + needs: create_package # The type of runner that the job will run on runs-on: ubuntu-latest @@ -23,8 +57,11 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it uses: actions/checkout@v2 - - name: "install ghostscript" - run: sudo apt-get install -y ghostscript + - uses: actions/download-artifact@v3 + id: download + + # - name: "install ghostscript" + # run: sudo apt-get install -y ghostscript ###### multiple options for a TeX environment # ## @@ -45,11 +82,11 @@ jobs: # with: # package-file: .github/tex/packages.test.txt # ## - - 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 + # - 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 # - name: "install tikz-trackschematic" # run: ./build.sh --non-interactive --install-dev diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e84d88b..521b62a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,8 @@ on: ## A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - release: + create_package: + name: "create a TeX Live package for tikz-trackschematic" runs-on: ubuntu-latest steps: # 1. checkout the repo @@ -32,8 +33,7 @@ jobs: - name: "update tikz-trackschematic documentation before release" run: ./build.sh --non-interactive --memory-increase --compile-doc - # 4. create package and release notes - ## get varibale ${{ steps.tag.outputs.tag }} + # 4. get varibale ${{ steps.tag.outputs.tag }} - name: "get tag" id: tag uses: dawidd6/action-get-tag@v1 @@ -41,10 +41,48 @@ jobs: # Optionally strip `v` prefix strip_v: false + # 5. create package and release notes - name: "create tikz-trackschematic package" run: ./build.sh --non-interactive --release ${{ steps.tag.outputs.tag }} - - # 5. publish package as new release on github + + # 6. upload artifact to share it with other jobs + - uses: actions/upload-artifact@v3 + with: + path: tikz-trackschematic-v0.7.0.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: release-note-v0.7.0.md + if-no-files-found: warn # 'error' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: .github/tex/tikz-trackschematic.pkg + if-no-files-found: warn # 'error' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: .github/zenodo/metadata.json + if-no-files-found: warn # 'error' or 'ignore' are also available, defaults to `warn` + + publish_github: + needs: create_package + name: "publish on github" + runs-on: ubuntu-latest + steps: + # 1. get varibale ${{ steps.tag.outputs.tag }} + - name: "get tag" + id: tag + uses: dawidd6/action-get-tag@v1 + with: + # Optionally strip `v` prefix + strip_v: false + + # 2. download artifact in folder artifact/ + - uses: actions/download-artifact@v3 + + # 3. publish package as new release on github - name: "create release" id: create_release uses: actions/create-release@v1 @@ -53,7 +91,7 @@ jobs: with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} - body_path: release-note-${{ steps.tag.outputs.tag }}.md + body_path: artifact/release-note-${{ steps.tag.outputs.tag }}.md draft: false prerelease: false @@ -63,7 +101,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip + asset_path: artifact/tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip asset_name: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip asset_content_type: application/zip @@ -74,6 +112,21 @@ jobs: with: id: ${{ steps.create_release.outputs.id }} - # 6. upload new release to CTAN + publish_CTAN: + needs: create_package + name: "publish on CTAN" + runs-on: ubuntu-latest + steps: + # 1. download artifact in folder artifact/ + - uses: actions/download-artifact@v3 + + # 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 - name: CTAN submit - run: ctan-o-mat --verbose --submit .github/tex/tikz-trackschematic.pkg + run: ctan-o-mat --verbose --submit artifact/tikz-trackschematic.pkg diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 978ed94..803bd72 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: test +name: "continuous integration test" # Controls when the workflow will run on: diff --git a/.github/workflows/zenodo.yaml b/.github/workflows/zenodo.yaml new file mode 100644 index 0000000..36911c6 --- /dev/null +++ b/.github/workflows/zenodo.yaml @@ -0,0 +1,72 @@ +name: zenodo sandbox test +on: + # # Trigger when you publish a release via GitHub's release page + # release: + # types: + # - published + + # # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + create_package: + name: "create a TeX Live package" + runs-on: ubuntu-latest + steps: + # checkout the repo + - name: "checkout" + uses: actions/checkout@v2 + + # create package and release notes + - name: "create tikz-trackschematic package" + run: ./build.sh --non-interactive --release v0.7.0 + + # upload artifact to share it with other jobs + - uses: actions/upload-artifact@v3 + with: + path: tikz-trackschematic-v0.7.0.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: release-note-v0.7.0.md + if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: .github/tex/tikz-trackschematic.pkg + if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` + + - uses: actions/upload-artifact@v3 + with: + path: .github/zenodo/metadata.json + if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` + + publish_zenodo: + needs: create_package + name: "publish on zenodo sandbox" + runs-on: ubuntu-latest + steps: + # checkout the repo + - name: "checkout" + uses: actions/checkout@v2 + + # download artifact in folder artifact/ + - uses: actions/download-artifact@v3 + + - name: "uploading to zenodo sandbox" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }} + ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }} + uses: zenodraft/action@0.10.0 + with: + # collection: 5539844 + collection: 1047380 + filenames: artifact/tikz-trackschematic-v0.7.0.zip + upsert-doi: true + upsert-location: identifiers[2] + metadata: artifact/metadata.json + publish: true + sandbox: true + verbose: true \ No newline at end of file diff --git a/.github/zenodo/metadata.json b/.github/zenodo/metadata.json new file mode 100644 index 0000000..08658dd --- /dev/null +++ b/.github/zenodo/metadata.json @@ -0,0 +1,30 @@ +{ + "title": "TikZ-trackschematic", + "version": "%%[SCRIPT]", + "publication_date": "%%[SCRIPT]", + "creators": [ + { + "orcid": "0000-0002-9384-8945", + "affiliation": "TU Braunschweig", + "name": "Scheidt, Martin" + } + ], + "description": "A TikZ library for creating track diagrams in railways. The TikZ-trackschematic library is a toolbox of symbols geared primarily towards creating track schematic for either research or educational purposes. It provides a TikZ frontend to some of the symbols which maybe needed to describe situations and layouts in railway operation.", + "keywords": [ + "tex", + "tikz", + "railway", + "railroad", + "tracks", + "schematics" + ], + "license": { + "id": "ISC" + }, + "language": "eng", + "access_right": "open", + "resource_type": { + "type": "software", + "title": "Software" + } +} \ No newline at end of file diff --git a/README.md b/README.md index cdb1d03..8112549 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # TikZ-trackschematic -[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5539844.svg)](https://doi.org/10.5281/zenodo.5539844) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5539844.svg)](https://doi.org/10.5281/zenodo.5539844) [![continuous integration test](https://github.com/railtoolkit/tikz-trackschematic/actions/workflows/testing.yml/badge.svg)](https://github.com/railtoolkit/tikz-trackschematic/actions/workflows/testing.yml) ------------ diff --git a/build.sh b/build.sh index 975fc4d..1fac1bf 100755 --- a/build.sh +++ b/build.sh @@ -591,6 +591,15 @@ create_ctan_configuration() { mv .github/tex/tikz-trackschematic.tmp.pkg .github/tex/tikz-trackschematic.pkg } +create_zenodo_metadata() { + # modify the file .github/zenodo/metadata.json for zenodo upload + # 1. replace "version": "%%[SCRIPT]" + sed -i".backup" -e"s/\"version\": \"%%\[SCRIPT\]\"/\"version\": \"$VERSION_STR\"/g" .github/zenodo/metadata.json + + # 2. replace "publication_date": "%%[SCRIPT]" + sedi "s/\"publication_date\": \"%%\[SCRIPT\]\"/\"publication_date\": \"$DATE\"/g" .github/zenodo/metadata.json +} + run_compile_documentation() { ## compile order # 1. manual, symbology-table, snippets @@ -959,6 +968,8 @@ cleanup() { rm release-note.tmp.md # # undo changes to .github/tex/tikz-trackschematic.pkg by sed # mv .github/tex/tikz-trackschematic.pkg.backup .github/tex/tikz-trackschematic.pkg + # # undo changes to .github/zenodo/metadata.json by sed + # mv .github/zenodo/metadata.json.backup .github/zenodo/metadata.json fi ## @@ -1052,6 +1063,7 @@ if [ $RELEASE = 1 ]; then create_release create_release_notes create_ctan_configuration + create_zenodo_metadata fi ##