Skip to content

Commit

Permalink
zenodo upload with CLI zenodraft
Browse files Browse the repository at this point in the history
  • Loading branch information
kaat0 committed Apr 6, 2022
1 parent bdf6799 commit 0b1a14f
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 120 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:

# download artifact in folder artifact/
- uses: actions/download-artifact@v3
- run: cd artifact

# - name: "install ghostscript"
# run: sudo apt-get install -y ghostscript
Expand Down Expand Up @@ -108,6 +107,9 @@ jobs:

## opening a debug console
- name: Setup upterm session
env:
# ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
uses: lhotari/action-upterm@v1
with:
limit-access-to-actor: true
129 changes: 65 additions & 64 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,23 @@ on:
jobs:
create_package:
name: "create a TeX Live package for tikz-trackschematic"
outputs:
version: ${{ steps.tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
# 1. checkout the repo
# 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
- name: "checkout"
uses: actions/checkout@v2

# 2. install TeX Live
# 3. install TeX Live
- name: "install ghostscript"
run: sudo apt-get install -y ghostscript

Expand All @@ -29,42 +39,29 @@ jobs:
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.doc.txt

# 3. (re-)compile the documentation
# 4. (re-)compile the documentation
- name: "update tikz-trackschematic documentation before release"
run: ./build.sh --non-interactive --memory-increase --compile-doc

# 4. 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

# 5. create package and release notes
- name: "create tikz-trackschematic package"
run: ./build.sh --non-interactive --release ${{ steps.tag.outputs.tag }}

# 6. upload artifact to share it with other jobs
- uses: actions/upload-artifact@v3
with:
path: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
path: |
tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
release-note-${{ steps.tag.outputs.tag }}.md
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`

- uses: actions/upload-artifact@v3
with:
path: release-note-${{ steps.tag.outputs.tag }}.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`

if-no-files-found: error # '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 # 'error' or 'ignore' are also available, defaults to `warn`
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`

publish_github:
needs: create_package
Expand All @@ -74,15 +71,7 @@ jobs:
# 1. download artifact in folder artifact/
- uses: actions/download-artifact@v3

# 2. 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

# 3. publish package as new release on github
# 2. creating a new release
- name: "create release"
id: create_release
uses: actions/create-release@v1
Expand All @@ -91,20 +80,22 @@ jobs:
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: artifact/release-note-${{ steps.tag.outputs.tag }}.md
body_path: artifact/release-note-${{needs.create_package.outputs.version}}.md
draft: false
prerelease: false


# 3. upload package to new release
- 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 }}
asset_path: artifact/tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
asset_name: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
asset_path: artifact/tikz-trackschematic-${{needs.create_package.outputs.version}}.zip
asset_name: tikz-trackschematic-${{needs.create_package.outputs.version}}.zip
asset_content_type: application/zip

# 4. publish release on github
- name: "publish release"
uses: StuYarrow/publish-release@v1
env:
Expand All @@ -117,11 +108,10 @@ jobs:
name: "publish on CTAN"
runs-on: ubuntu-latest
steps:
# 1. download artifact in folder artifact/
# 1. download artifact in folder artifact/ and move it one level up
- uses: actions/download-artifact@v3
- run: |
mv ./artifact/tikz-trackschematic-*.zip ./
mv ./artifact/tikz-trackschematic.pkg ./
# 2. install ctan-o-mat
- name: "setup TeX Live (via paolobrasolin)"
Expand All @@ -132,43 +122,54 @@ jobs:

# 3. upload new release to CTAN
- name: CTAN submit
run: ctan-o-mat --verbose --submit tikz-trackschematic.pkg
run: ctan-o-mat --verbose --submit artifact/tikz-trackschematic.pkg

publish_zenodo:
needs: create_package
name: "publish on zenodo sandbox"
name: "publish on zenodo"
outputs:
doi: ${{ steps.zenodraft.outputs.doi }}
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. checkout the repo for zenodraft/[email protected] to work
- name: "checkout"
uses: actions/checkout@v2

# 3. download artifact in folder artifact/ and move it one level up
# 1. download artifact in folder artifact/ and move it one level up
- uses: actions/download-artifact@v3
- run: |
mv ./artifact/tikz-trackschematic-*.zip ./
mv ./artifact/metadata.json ./
# 4. upload to zenodo
- name: "uploading to zenodo sandbox"
# 2. install zenodraft
- name: "install zenodraft"
run: npm install -g zenodraft

# 3. upload new release to zenodo
- name: "uploading to zenodo"
id: zenodraft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
uses: zenodraft/[email protected]
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:
# 1. checkout the repo for zenodraft/[email protected] to work
- name: "checkout"
uses: actions/checkout@v2

- run: ./build.sh --update-cite ${{needs.publish_zenodo.outputs.doi}}

- name: push
uses: github-actions-x/[email protected]
with:
collection: 5539844
filenames: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
upsert-doi: true
upsert-location: identifiers[1]
metadata: metadata.json
publish: true
sandbox: false
verbose: true
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'master'
force-add: 'true'
files: CITATION.cff
commit-message: 'updated DOI (via github action)'
rebase: 'true' # pull and rebase before commit
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: "setup TeX Live (via paolobrasolin)"
uses: paolobrasolin/setup-texlive-action@v1
with:
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
profile-path: ${{ github.workspace }}/.github/tex/profile.basic.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.test.txt

- name: "test tikz-trackschematic"
Expand Down
109 changes: 80 additions & 29 deletions .github/workflows/zenodo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,116 @@ on:
jobs:
create_package:
name: "create a TeX Live package"
outputs:
version: ${{ steps.tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
# set varibale ${{ steps.tag.outputs.tag }}
- name: "get tag"
id: tag
run: echo "::set-output name=tag::v0.7.0"

# 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
run: ./build.sh --non-interactive --release ${{ steps.tag.outputs.tag }}

# upload artifact to share it with other jobs
- uses: actions/upload-artifact@v3
with:
path: tikz-trackschematic-v0.7.0.zip
path: |
tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
release-note-${{ steps.tag.outputs.tag }}.md
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`

if-no-files-found: error # '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`
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"
# uses: actions/checkout@v2

# # 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/[email protected]
# 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

publish_zenodo:
needs: create_package
name: "publish on zenodo sandbox"
outputs:
doi: ${{ steps.zenodraft.outputs.doi }}
runs-on: ubuntu-latest
steps:
# checkout the repo
- name: "checkout"
uses: actions/checkout@v2

# download artifact in folder artifact/
- uses: actions/download-artifact@v3
- run: |
mv ./artifact/tikz-trackschematic-*.zip ./
mv ./artifact/metadata.json ./
mv ./artifact/tikz-trackschematic-${{needs.create_package.outputs.version}}.zip ./
- name: "install zenodraft"
run: npm install -g zenodraft

- name: "uploading to zenodo sandbox"
id: zenodraft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
uses: zenodraft/[email protected]
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/[email protected] to work
- name: "checkout"
uses: actions/checkout@v2

- run: ./build.sh --update-cite ${{needs.publish_zenodo.outputs.doi}}

- name: push
uses: github-actions-x/[email protected]
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
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'github-action'
force-add: 'true'
files: CITATION.cff
commit-message: 'updated DOI (via github action)'
name: Martin Scheidt
email: [email protected]
3 changes: 2 additions & 1 deletion .github/zenodo/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"title": "TikZ-trackschematic",
"version": "%%[SCRIPT]",
"version": "%%[SCRIPT]",
"publication_date": "%%[SCRIPT]",
"creators": [
{
"orcid": "0000-0002-9384-8945",
Expand Down
Loading

0 comments on commit 0b1a14f

Please sign in to comment.