tikz-trackschematic/.github/workflows/zenodo.yaml

127 lines
4.2 KiB
YAML
Raw Normal View History

2022-04-01 21:36:25 +02:00
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"
2022-04-05 14:28:09 +02:00
outputs:
version: ${{ steps.tag.outputs.tag }}
2022-04-01 21:36:25 +02:00
runs-on: ubuntu-latest
steps:
2022-04-05 14:28:09 +02:00
# set varibale ${{ steps.tag.outputs.tag }}
- name: "get tag"
id: tag
run: echo "::set-output name=tag::v0.7.0"
2022-04-01 21:36:25 +02:00
# checkout the repo
- name: "checkout"
2022-04-18 18:03:18 +02:00
uses: actions/checkout@v3
2022-04-01 21:36:25 +02:00
# create package and release notes
- name: "create tikz-trackschematic package"
2022-04-05 14:28:09 +02:00
run: ./build.sh --non-interactive --release ${{ steps.tag.outputs.tag }}
2022-04-01 21:36:25 +02:00
# 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`
# publish_zenodo:
# needs: create_package
# name: "publish on zenodo sandbox"
# runs-on: ubuntu-latest
# steps:
# # checkout the repo
# - name: "checkout"
2022-04-18 18:03:18 +02:00
# uses: actions/checkout@v3
2022-04-05 14:28:09 +02:00
# # download artifact in folder artifact/
# - uses: actions/download-artifact@v3
# - run: |
# mv ./artifact/tikz-trackschematic-*.zip ./
# mv ./artifact/metadata.json ./
# - 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: tikz-trackschematic-v0.7.0.zip
# upsert-doi: true
# upsert-location: identifiers[1]
# metadata: metadata.json
# publish: true
# sandbox: true
# verbose: true
2022-04-01 21:36:25 +02:00
publish_zenodo:
needs: create_package
name: "publish on zenodo sandbox"
2022-04-05 14:28:09 +02:00
outputs:
doi: ${{ steps.zenodraft.outputs.doi }}
2022-04-01 21:36:25 +02:00
runs-on: ubuntu-latest
steps:
# download artifact in folder artifact/
- uses: actions/download-artifact@v3
2022-04-04 11:01:51 +02:00
- run: |
2022-04-05 14:28:09 +02:00
mv ./artifact/tikz-trackschematic-${{needs.create_package.outputs.version}}.zip ./
- name: "install zenodraft"
run: npm install -g zenodraft
2022-04-01 21:36:25 +02:00
- name: "uploading to zenodo sandbox"
2022-04-05 14:28:09 +02:00
id: zenodraft
2022-04-01 21:36:25 +02:00
env:
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
2022-04-05 14:28:09 +02:00
COLLECTION: 1047380
run: |
ID=$(zenodraft --sandbox deposition create in-existing-collection $COLLECTION)
zenodraft --sandbox file add $ID tikz-trackschematic-*.zip
zenodraft --sandbox metadata update $ID artifact/metadata.json
zenodraft --sandbox deposition publish $ID
echo "::set-output name=doi::$(zenodraft --sandbox deposition show prereserved $ID)"
update_citation:
needs: publish_zenodo
name: "updates CITATION.cff"
runs-on: ubuntu-latest
steps:
# 1. checkout the repo for zenodraft/action@0.10.0 to work
- name: "checkout"
2022-04-18 18:03:18 +02:00
uses: actions/checkout@v3
2022-04-05 14:28:09 +02:00
- run: ./build.sh --update-cite ${{needs.publish_zenodo.outputs.doi}}
- name: push
uses: github-actions-x/commit@v2.8
2022-04-01 21:36:25 +02:00
with:
2022-04-05 14:28:09 +02:00
github-token: ${{ secrets.GITHUB_TOKEN }}
2022-06-01 15:28:56 +02:00
push-branch: 'master'
2022-04-05 14:28:09 +02:00
force-add: 'true'
files: CITATION.cff
commit-message: 'updated DOI (via github action)'
name: Martin Scheidt
email: m.scheidt@tu-bs.de