Merge pull request #29 from railtoolkit/development
updated github actions and automated documentationmaster
commit
ac5f06edd6
|
@ -12,6 +12,7 @@ on:
|
||||||
- '.github/workflows/cffvalidation.yml'
|
- '.github/workflows/cffvalidation.yml'
|
||||||
- '.github/workflows/CompatHelper.yml'
|
- '.github/workflows/CompatHelper.yml'
|
||||||
- '.github/workflows/debug.yml'
|
- '.github/workflows/debug.yml'
|
||||||
|
- '.github/workflows/documenter.yml'
|
||||||
- '.github/workflows/JuliaRegister.yml'
|
- '.github/workflows/JuliaRegister.yml'
|
||||||
- '.github/workflows/release.yml'
|
- '.github/workflows/release.yml'
|
||||||
- '.github/workflows/TagBot.yml'
|
- '.github/workflows/TagBot.yml'
|
||||||
|
@ -28,6 +29,7 @@ on:
|
||||||
- '.github/workflows/cffvalidation.yml'
|
- '.github/workflows/cffvalidation.yml'
|
||||||
- '.github/workflows/CompatHelper.yml'
|
- '.github/workflows/CompatHelper.yml'
|
||||||
- '.github/workflows/debug.yml'
|
- '.github/workflows/debug.yml'
|
||||||
|
- '.github/workflows/documenter.yml'
|
||||||
- '.github/workflows/JuliaRegister.yml'
|
- '.github/workflows/JuliaRegister.yml'
|
||||||
- '.github/workflows/release.yml'
|
- '.github/workflows/release.yml'
|
||||||
- '.github/workflows/TagBot.yml'
|
- '.github/workflows/TagBot.yml'
|
||||||
|
@ -59,7 +61,7 @@ jobs:
|
||||||
- x64
|
- x64
|
||||||
# - aarch64
|
# - aarch64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: julia-actions/setup-julia@v1
|
- uses: julia-actions/setup-julia@v1
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
|
@ -67,22 +69,3 @@ jobs:
|
||||||
- uses: julia-actions/cache@v1
|
- uses: julia-actions/cache@v1
|
||||||
- uses: julia-actions/julia-buildpkg@v1
|
- uses: julia-actions/julia-buildpkg@v1
|
||||||
- uses: julia-actions/julia-runtest@v1
|
- uses: julia-actions/julia-runtest@v1
|
||||||
docs:
|
|
||||||
name: Documentation
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: julia-actions/setup-julia@v1
|
|
||||||
with:
|
|
||||||
version: '1'
|
|
||||||
- uses: julia-actions/julia-buildpkg@v1
|
|
||||||
- uses: julia-actions/julia-docdeploy@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
|
|
||||||
- run: |
|
|
||||||
julia --project=docs -e '
|
|
||||||
using Documenter: DocMeta, doctest
|
|
||||||
using TrainRuns
|
|
||||||
DocMeta.setdocmeta!(TrainRuns, :DocTestSetup, :(using TrainRuns); recursive=true)
|
|
||||||
doctest(TrainRuns)'
|
|
||||||
|
|
|
@ -12,21 +12,58 @@ on:
|
||||||
|
|
||||||
## A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
## A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
jobs:
|
jobs:
|
||||||
debug:
|
|
||||||
# needs: create_package
|
|
||||||
# The type of runner that the job will run on
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
debug:
|
||||||
|
name: "debug"
|
||||||
|
outputs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: "checkout"
|
- name: "checkout"
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
## opening a debug console
|
# ## opening a debug console
|
||||||
- name: Setup upterm session
|
# - name: Setup upterm session
|
||||||
env:
|
# env:
|
||||||
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
|
# ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
|
||||||
uses: lhotari/action-upterm@v1
|
# uses: lhotari/action-upterm@v1
|
||||||
with:
|
# with:
|
||||||
limit-access-to-actor: true
|
# limit-access-to-actor: true
|
||||||
|
|
||||||
|
# debug1:
|
||||||
|
# name: "debug 1"
|
||||||
|
# outputs:
|
||||||
|
# output_variable: ${{ steps.set_variable.outputs.output_variable }}
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# # Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
# steps:
|
||||||
|
# - name: "use the variable from previous step 'create variable'"
|
||||||
|
# id: use_variable
|
||||||
|
# run: |
|
||||||
|
# echo "1. Current values:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
# echo "output variable: '${{ env.output_variable }}'" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# - name: "overwrite variable"
|
||||||
|
# id: set_variable
|
||||||
|
# run: |
|
||||||
|
# echo "2. set varibales!" >> $GITHUB_STEP_SUMMARY
|
||||||
|
# echo "output_variable=output" >> $GITHUB_OUTPUT # set variable
|
||||||
|
|
||||||
|
# - name: "use the variable from previous step 'create variable'"
|
||||||
|
# id: use_variable_step
|
||||||
|
# run: |
|
||||||
|
# echo "3. use the variable from previous step" >> $GITHUB_STEP_SUMMARY
|
||||||
|
# echo "output variable (via environment): '${{ env.output_variable }}'" >> $GITHUB_STEP_SUMMARY
|
||||||
|
# echo "output variable (via output): '${{ steps.set_variable.outputs.output_variable }}'" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# debug2:
|
||||||
|
# name: "debug 2"
|
||||||
|
# needs: debug1
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - name: "use the variable from previous job 'debug 1'"
|
||||||
|
# id: use_variable_job
|
||||||
|
# run: |
|
||||||
|
# echo "4. use the variable from previous job" >> $GITHUB_STEP_SUMMARY
|
||||||
|
# echo "output variable (via environment): '${{ env.output_variable }}'" >> $GITHUB_STEP_SUMMARY
|
||||||
|
# echo "output variable (via output): '${{ needs.debug1.outputs.output_variable }}'" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
name: Documentation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main # update to match your development branch (master, main, dev, trunk, ...)
|
||||||
|
tags: '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: julia-actions/setup-julia@v1
|
||||||
|
with:
|
||||||
|
version: '1'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
|
||||||
|
- name: Build and deploy
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
|
||||||
|
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
|
||||||
|
run: julia --project=docs/ --code-coverage=railtoolkit docs/make.jl
|
||||||
|
- uses: julia-actions/julia-processcoverage@v1
|
||||||
|
- uses: codecov/codecov-action@v3
|
|
@ -4,57 +4,62 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: "Version to register (without leading 'v' and semantic versioning schema, e.g. '1.0.1')"
|
description: "Version to register (semantic versioning schema, e.g. '1.0.1'):"
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create_package:
|
version:
|
||||||
name: "create package"
|
name: ":triangular_flag_on_post: check submitted version - "
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
previous_version: ${{ steps.version_test.outputs.previous_version }}
|
current: ${{ steps.version_check.outputs.current }}
|
||||||
|
new: ${{ steps.version_check.outputs.new }}
|
||||||
steps:
|
steps:
|
||||||
# 1. checkout the repo
|
|
||||||
- name: "checkout"
|
- name: "checkout"
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# 2. test if provided version number fits in semantic versioning schema
|
- name: "check version number"
|
||||||
- name: "test version number"
|
id: version_check
|
||||||
id: version_test
|
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.event.inputs.version }}
|
VERSION=${{ github.event.inputs.version }}
|
||||||
echo "check if version follows the semantic version pattern"
|
echo "Version to register '$VERSION':" >> $GITHUB_STEP_SUMMARY
|
||||||
|
## =================================
|
||||||
|
## check if version follows the semantic version pattern
|
||||||
|
## ---------------------------------
|
||||||
|
#remove a trailing 'v' if it exists
|
||||||
|
if [[ ${VERSION:0:1} -eq "v" ]]; then
|
||||||
|
VERSION=${VERSION:1}
|
||||||
|
fi
|
||||||
|
# check with regular expressions
|
||||||
SEM_VER_REGEX="^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$"
|
SEM_VER_REGEX="^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$"
|
||||||
STATUS=0
|
STATUS=0
|
||||||
if [[ ! $VERSION =~ $SEM_VER_REGEX ]]; then
|
if [[ ! $VERSION =~ $SEM_VER_REGEX ]]; then
|
||||||
STATUS=1
|
STATUS=1
|
||||||
fi
|
fi
|
||||||
if [ $STATUS = 1 ]; then
|
if [ $STATUS = 1 ]; then
|
||||||
echo "Version $VERSION does not follow the semantic versioning schema."
|
echo "- :no_entry_sign: format does not follow the semantic versioning schema" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Please see https://semver.org/ for further information."
|
echo ":warning: Please see https://semver.org/ for further information." >> $GITHUB_STEP_SUMMARY
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
echo "- format follows the semantic versioning schema :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
echo "check if version was already used"
|
## =================================
|
||||||
grep -qs "Version \[$VERSION\]" CHANGELOG.md && STATUS=1
|
## check if version is an increment
|
||||||
if [ $STATUS = 1 ]; then
|
## ---------------------------------
|
||||||
echo "Version $VERSION is already present in CHANGELOG.md."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "check if version is an increment"
|
|
||||||
VERSION_MAJOR=$(echo $VERSION | cut -d. -f1 )
|
VERSION_MAJOR=$(echo $VERSION | cut -d. -f1 )
|
||||||
VERSION_MINOR=$(echo $VERSION | cut -d. -f2 )
|
VERSION_MINOR=$(echo $VERSION | cut -d. -f2 )
|
||||||
VERSION_PATCH=$(echo $VERSION | cut -d. -f3 )
|
VERSION_PATCH=$(echo $VERSION | cut -d. -f3 )
|
||||||
PREVIOUS_VERSION=$(grep -n -m 1 "## Version \[*.*.*\]" CHANGELOG.md | cut -d[ -f2 | cut -d] -f1)
|
CURRENT_VERSION=$(grep -n -m 1 "## Version \[*.*.*\]" CHANGELOG.md | cut -d[ -f2 | cut -d] -f1)
|
||||||
PREVIOUS_VERSION_MAJOR=$(echo $PREVIOUS_VERSION | cut -d. -f1 )
|
CURRENT_VERSION_MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1 )
|
||||||
PREVIOUS_VERSION_MINOR=$(echo $PREVIOUS_VERSION | cut -d. -f2 )
|
CURRENT_VERSION_MINOR=$(echo $CURRENT_VERSION | cut -d. -f2 )
|
||||||
PREVIOUS_VERSION_PATCH=$(echo $PREVIOUS_VERSION | cut -d. -f3 )
|
CURRENT_VERSION_PATCH=$(echo $CURRENT_VERSION | cut -d. -f3 )
|
||||||
if [[ $VERSION_MAJOR -eq PREVIOUS_VERSION_MAJOR ]]; then
|
if [[ $VERSION_MAJOR -eq CURRENT_VERSION_MAJOR ]]; then
|
||||||
if [[ $VERSION_MINOR -eq PREVIOUS_VERSION_MINOR ]]; then
|
if [[ $VERSION_MINOR -eq CURRENT_VERSION_MINOR ]]; then
|
||||||
if [[ $(($VERSION_PATCH - 1)) -ne PREVIOUS_VERSION_PATCH ]]; then
|
if [[ $(($VERSION_PATCH - 1)) -ne CURRENT_VERSION_PATCH ]]; then
|
||||||
STATUS=1
|
STATUS=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ $(($VERSION_MINOR - 1)) -eq PREVIOUS_VERSION_MINOR ]]; then
|
if [[ $(($VERSION_MINOR - 1)) -eq CURRENT_VERSION_MINOR ]]; then
|
||||||
if [[ $VERSION_PATCH -ne 0 ]]; then
|
if [[ $VERSION_PATCH -ne 0 ]]; then
|
||||||
STATUS=1
|
STATUS=1
|
||||||
fi
|
fi
|
||||||
|
@ -63,7 +68,7 @@ jobs:
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ $(($VERSION_MAJOR - 1)) -eq PREVIOUS_VERSION_MAJOR ]]; then
|
if [[ $(($VERSION_MAJOR - 1)) -eq CURRENT_VERSION_MAJOR ]]; then
|
||||||
if [[ $VERSION_MINOR -ne 0 ]]; then
|
if [[ $VERSION_MINOR -ne 0 ]]; then
|
||||||
STATUS=1
|
STATUS=1
|
||||||
fi
|
fi
|
||||||
|
@ -75,68 +80,88 @@ jobs:
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $STATUS = 1 ]; then
|
if [ $STATUS = 1 ]; then
|
||||||
echo "Version $VERSION skipped steps from the previous version $PREVIOUS_VERSION and thus does not follow the semantic versioning schema."
|
echo "- :no_entry_sign: Version skipped steps from the previous version $CURRENT_VERSION and thus does not follow the semantic versioning schema." >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Please see https://semver.org/ for further information."
|
echo "- :warning: Please see https://semver.org/ for further information." >> $GITHUB_STEP_SUMMARY
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
echo "- is an increment from the previous version :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
echo "::set-output name=previous_version::$(version_test deposition show prereserved $PREVIOUS_VERSION)"
|
## =================================
|
||||||
|
## provide variables for subsequent jobs
|
||||||
|
## ---------------------------------
|
||||||
|
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "new=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# 3. create release note
|
create_package:
|
||||||
|
name: "create package"
|
||||||
|
needs: [version]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: echo "Creating package and release note for '${{ needs.version.outputs.new }}':" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# 1. checkout the repo
|
||||||
|
- name: "checkout"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# 2. create release note
|
||||||
- name: "create release note"
|
- name: "create release note"
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.event.inputs.version }}
|
VERSION=${{ needs.version.outputs.new }}
|
||||||
PREVIOUS_VERSION=${{ needs.create_package.outputs.previous_version }}
|
CURRENT_VERSION=${{ needs.version.outputs.current }}
|
||||||
STATUS=0
|
STATUS=0
|
||||||
echo "create release note"
|
## =================================
|
||||||
|
## create release note
|
||||||
|
## ---------------------------------
|
||||||
TOP=$(grep -n "## \[Unreleased\]" CHANGELOG.md | cut -d: -f1)
|
TOP=$(grep -n "## \[Unreleased\]" CHANGELOG.md | cut -d: -f1)
|
||||||
TOP=$(( $TOP + 1 ))
|
BOTTOM=$(grep -n -m 1 "## Version \[$CURRENT_VERSION\]" CHANGELOG.md | cut -d: -f1)
|
||||||
BOTTOM=$(grep -n -m 1 "## Version \[$PREVIOUS_VERSION\]" CHANGELOG.md | cut -d: -f1)
|
|
||||||
BOTTOM=$(( $BOTTOM - 1 ))
|
|
||||||
awk "NR>$TOP&&NR<$BOTTOM" CHANGELOG.md > release-note-v$VERSION.md
|
awk "NR>$TOP&&NR<$BOTTOM" CHANGELOG.md > release-note-v$VERSION.md
|
||||||
sed -i -- "s/###/##/g" release-note-v$VERSION.md
|
sed -i -- "s/###/##/g" release-note-v$VERSION.md
|
||||||
echo "check if release note is empty"
|
## =================================
|
||||||
|
## check if release note is empty
|
||||||
|
## ---------------------------------
|
||||||
WORD_COUNT=$(wc -w release-note-v$VERSION.md | awk '{print $1}')
|
WORD_COUNT=$(wc -w release-note-v$VERSION.md | awk '{print $1}')
|
||||||
if [[ $WORD_COUNT -lt 4 ]]; then
|
if [[ $WORD_COUNT -lt 4 ]]; then
|
||||||
STATUS=1
|
STATUS=1
|
||||||
fi
|
fi
|
||||||
if [ $STATUS = 1 ]; then
|
if [ $STATUS = 1 ]; then
|
||||||
echo "Please provide a meaningful CHANGELOG.md for the new version $VERSION"
|
echo "- :no_entry_sign: 'Unreleased' section in CHANGELOG.md is empty" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo ":warning: Please provide a meaningful CHANGELOG.md for the new version $VERSION"." >> $GITHUB_STEP_SUMMARY
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
echo "- 'Unreleased' section in CHANGELOG.md has content :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
|
## =================================
|
||||||
|
## remove empty lines from top and bottom
|
||||||
|
## ---------------------------------
|
||||||
|
sed -i -- -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' release-note-v$VERSION.md
|
||||||
|
|
||||||
# 4. Update zenodo metadata.json
|
# 3. create release archive
|
||||||
- name: "Update zenodo metadata.json"
|
|
||||||
run: |
|
|
||||||
VERSION=${{ github.event.inputs.version }}
|
|
||||||
sed -i".backup" -e"s/\"version\": \"%%\[SCRIPT\]\"/\"version\": \"$VERSION\"/g" .github/zenodo/metadata.json
|
|
||||||
|
|
||||||
# 5. create release archive
|
|
||||||
- name: "create release archive"
|
- name: "create release archive"
|
||||||
uses: papeloto/action-zip@v1
|
uses: papeloto/action-zip@v1
|
||||||
with:
|
with:
|
||||||
files: docs src test README.md LICENSE Project.toml
|
files: docs src test README.md LICENSE Project.toml
|
||||||
recursive: false
|
recursive: false
|
||||||
dest: TrainRuns.jl-v${{ github.event.inputs.version }}.zip
|
dest: TrainRuns.jl-v${{ needs.version.outputs.new }}.zip
|
||||||
|
- run: echo "- creating ZIP-Archive for the new release :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# 6. upload artifact to share it with other jobs
|
# 4. upload artifact to share it with other jobs
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
release-note-v${{ github.event.inputs.version }}.md
|
release-note-v${{ needs.version.outputs.new }}.md
|
||||||
TrainRuns.jl-v${{ github.event.inputs.version }}.zip
|
TrainRuns.jl-v${{ needs.version.outputs.new }}.zip
|
||||||
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: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
||||||
|
- run: echo "- providing ZIP-Archive and release notes for other jobs :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
publish_github:
|
publish_github:
|
||||||
needs: create_package
|
needs: [create_package, version]
|
||||||
name: "publish on github"
|
name: "publish on github"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- run: echo "Publishing package on Github:" >> $GITHUB_STEP_SUMMARY
|
||||||
# 1. download artifact in folder artifact/
|
# 1. download artifact in folder artifact/
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
|
- run: echo "- getting ZIP-Archive and release notes :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# 2. creating a new release
|
# 2. creating a new release
|
||||||
- name: "create release"
|
- name: "create release"
|
||||||
|
@ -147,9 +172,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
tag_name: ${{ github.ref }}
|
||||||
release_name: Release ${{ github.ref }}
|
release_name: Release ${{ github.ref }}
|
||||||
body_path: artifact/release-note-v${{ github.event.inputs.version }}.md
|
body_path: artifact/release-note-v${{ needs.version.outputs.new }}.md
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
- run: echo "- drafting new release :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# 3. upload package to new release
|
# 3. upload package to new release
|
||||||
- name: "upload release asset"
|
- name: "upload release asset"
|
||||||
|
@ -158,9 +184,10 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: artifact/TrainRuns.jl-v${{ github.event.inputs.version }}.zip
|
asset_path: artifact/TrainRuns.jl-v${{ needs.version.outputs.new }}.zip
|
||||||
asset_name: TrainRuns.jl-v${{ github.event.inputs.version }}.zip
|
asset_name: TrainRuns.jl-v${{ needs.version.outputs.new }}.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
- run: echo "- upload release asset :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# 4. publish release on github
|
# 4. publish release on github
|
||||||
- name: "publish release"
|
- name: "publish release"
|
||||||
|
@ -169,50 +196,83 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
id: ${{ steps.create_release.outputs.id }}
|
id: ${{ steps.create_release.outputs.id }}
|
||||||
|
- run: echo "- publish release at ${{ steps.create_release.outputs.html_url }} :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
publish_zenodo:
|
zenodo:
|
||||||
needs: create_package
|
needs: [create_package, version]
|
||||||
name: "publish on zenodo"
|
name: "publish on zenodo"
|
||||||
outputs:
|
outputs:
|
||||||
doi: ${{ steps.zenodraft.outputs.doi }}
|
doi: ${{ steps.zenodraft.outputs.doi }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- run: echo "Archiving package on zenodo to get a DOI:" >> $GITHUB_STEP_SUMMARY
|
||||||
# 1. 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
|
- uses: actions/download-artifact@v3
|
||||||
- run: |
|
- run: |
|
||||||
mv ./artifact/TrainRuns.jl-v${{ github.event.inputs.version }}.zip ./
|
mv ./artifact/TrainRuns.jl-v${{ needs.version.outputs.new }}.zip ./
|
||||||
|
echo "- getting ZIP-Archive and release notes :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# 2. install zenodraft
|
# 2. install zenodraft
|
||||||
- name: "install zenodraft"
|
- name: "install zenodraft"
|
||||||
run: npm install -g zenodraft
|
env:
|
||||||
|
URL: "https://zenodo.org/"
|
||||||
|
run: |
|
||||||
|
STATUS=0
|
||||||
|
npm install -g zenodraft
|
||||||
|
echo "- installing zenodraft :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
if ! curl --output /dev/null --silent --head --fail "$URL"; then
|
||||||
|
STATUS=1
|
||||||
|
fi
|
||||||
|
if [ $STATUS = 1 ]; then
|
||||||
|
echo "- :no_entry_sign: $URL is not reachable" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo ":warning: Please re-run action later!" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo ":warning: Please remove github release manually!" >> $GITHUB_STEP_SUMMARY
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "- $URL is reachable :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
|
|
||||||
# 3. upload new release to zenodo
|
# 3. Update zenodo metadata.json
|
||||||
|
- name: "Update zenodo metadata.json"
|
||||||
|
run: |
|
||||||
|
VERSION=${{ needs.version.outputs.new }}
|
||||||
|
sed -i".backup" -e"s/\"version\": \"%%\[SCRIPT\]\"/\"version\": \"$VERSION\"/g" .github/zenodo/metadata.json
|
||||||
|
echo "- updating zenodo metadata :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
# 4. upload new release to zenodo
|
||||||
- name: "uploading to zenodo"
|
- name: "uploading to zenodo"
|
||||||
id: zenodraft
|
id: zenodraft
|
||||||
env:
|
env:
|
||||||
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
|
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
|
||||||
COLLECTION: 6448563
|
COLLECTION: 6448563
|
||||||
run: |
|
run: |
|
||||||
ID=$(zenodraft deposition create version $COLLECTION)
|
DOI=$(zenodraft deposition create version $COLLECTION)
|
||||||
zenodraft file add $ID TrainRuns.jl-v*.zip
|
zenodraft file add $DOI TrainRuns.jl-v*.zip
|
||||||
zenodraft metadata update $ID artifact/metadata.json
|
zenodraft metadata update $DOI .github/zenodo/metadata.json
|
||||||
zenodraft deposition publish $ID
|
zenodraft deposition publish $DOI
|
||||||
echo "::set-output name=doi::$(zenodraft deposition show prereserved $ID)"
|
## =================================
|
||||||
|
## provide variables for subsequent jobs
|
||||||
|
## ---------------------------------
|
||||||
|
echo "doi=$DOI" >> $GITHUB_OUTPUT
|
||||||
|
echo "- publish release at zenodo with DOI: $DOI :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
update_repo:
|
update_repository:
|
||||||
needs: publish_zenodo
|
needs: [zenodo, version]
|
||||||
name: "updating CITATION.cff and CHANGELOG.md"
|
name: "updating CITATION.cff and CHANGELOG.md"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- run: echo "Updating CITATION.cff and CHANGELOG.md:" >> $GITHUB_STEP_SUMMARY
|
||||||
# 1. checkout the repo
|
# 1. checkout the repo
|
||||||
- name: "checkout"
|
- name: "checkout"
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
# with:
|
||||||
|
# ref: main
|
||||||
|
|
||||||
# 2. update CITATION.cff
|
# 2. update CITATION.cff
|
||||||
- name: "update CITATION.cff"
|
- name: "update CITATION.cff"
|
||||||
run: |
|
run: |
|
||||||
DATE=$(date "+%Y-%m-%d")
|
DATE=$(date "+%Y-%m-%d")
|
||||||
VERSION=${{ github.event.inputs.version }}
|
VERSION=${{ needs.version.outputs.new }}
|
||||||
DOI=${{ needs.publish_zenodo.outputs.doi }}
|
DOI=${{ needs.publish_zenodo.outputs.doi }}
|
||||||
echo "find lines in CITATION.cff"
|
echo "find lines in CITATION.cff"
|
||||||
VERSION_LINE=$(grep -n '^version:' CITATION.cff | cut -d: -f1)
|
VERSION_LINE=$(grep -n '^version:' CITATION.cff | cut -d: -f1)
|
||||||
|
@ -224,30 +284,33 @@ jobs:
|
||||||
sed -i -- "${VERSION_LINE}s|.*|version: $VERSION|" CITATION.cff
|
sed -i -- "${VERSION_LINE}s|.*|version: $VERSION|" CITATION.cff
|
||||||
sed -i -- "${DATE_LINE}s|.*|date-released: ${DATE}|" CITATION.cff
|
sed -i -- "${DATE_LINE}s|.*|date-released: ${DATE}|" CITATION.cff
|
||||||
sed -i -- "${DOI_LINE}s|.*| value: $DOI|" CITATION.cff
|
sed -i -- "${DOI_LINE}s|.*| value: $DOI|" CITATION.cff
|
||||||
|
echo "- updated CITATION.cff :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# 3. update CHANGELOG.md
|
# 3. update CHANGELOG.md
|
||||||
- name: "update CHANGELOG.md"
|
- name: "update CHANGELOG.md"
|
||||||
run: |
|
run: |
|
||||||
DATE=$(date "+%Y-%m-%d")
|
DATE=$(date "+%Y-%m-%d")
|
||||||
VERSION=${{ github.event.inputs.version }}
|
VERSION=${{ needs.version.outputs.new }}
|
||||||
URL="https://github.com/railtoolkit/TrainRuns.jl/compare"
|
URL="https://github.com/railtoolkit/TrainRuns.jl/compare"
|
||||||
PREVIOUS_VERSION=${{ needs.create_package.outputs.previous_version }}
|
CURRENT_VERSION=${{ needs.version.outputs.current }}
|
||||||
echo "increment CHANGELOG.md"
|
echo "increment CHANGELOG.md"
|
||||||
sed -i -- "/## \[Unreleased\]/a\\\n\n## Version [$VERSION] $DATE" CHANGELOG.md
|
sed -i -- "/## \[Unreleased\]/a\\\n\n## Version [$VERSION] $DATE" CHANGELOG.md
|
||||||
sed -i -- "s|^\[Unreleased\]: .*$|\[Unreleased\]: $URL/v$VERSION...main\n\[$VERSION\]: $URL/v$PREVIOUS_VERSION...v$VERSION|" CHANGELOG.md
|
sed -i -- "s|^\[Unreleased\]: .*$|\[Unreleased\]: $URL/v$VERSION...main\n\[$VERSION\]: $URL/v$CURRENT_VERSION...v$VERSION|" CHANGELOG.md
|
||||||
|
echo "- updated CHANGELOG.md :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# 4. push the change back to main
|
# 4. push the change back to main
|
||||||
- name: push
|
- name: push
|
||||||
uses: EndBug/add-and-commit@v9
|
uses: EndBug/add-and-commit@v9
|
||||||
with:
|
with:
|
||||||
message: "DOI updated to ${{ github.event.inputs.version }} (via github action)"
|
message: "updated to ${{ needs.version.outputs.new }} (via github action)"
|
||||||
add: CITATION.cff CHANGELOG.md
|
add: CITATION.cff CHANGELOG.md
|
||||||
author_name: railtoolkit
|
author_name: railtoolkit
|
||||||
author_email: railtoolkit@ownx.net
|
author_email: railtoolkit@ownx.net
|
||||||
|
- run: echo "- updated repository with new CITATION.cff and CHANGELOG.md :white_check_mark:" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
register:
|
register_julia:
|
||||||
needs: update_repo
|
needs: [update_repository]
|
||||||
name: "publish in JuliaRegistries"
|
name: ":checkered_flag: publish in JuliaRegistries"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# 1. register new release at JuliaRegistries
|
# 1. register new release at JuliaRegistries
|
||||||
|
@ -256,13 +319,13 @@ jobs:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
publish_mastodon:
|
publish_mastodon:
|
||||||
needs: publish_zenodo
|
needs: [zenodo, version, create_package]
|
||||||
name: "Send toot about it to railtoolkit@fosstodon.org"
|
name: ":checkered_flag: Send toot about it to railtoolkit@fosstodon.org"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: cbrgm/mastodon-github-action@v1
|
- uses: cbrgm/mastodon-github-action@v1
|
||||||
with:
|
with:
|
||||||
message: "The new version ${{ github.event.inputs.version }} of TrainRuns.jl is available! DOI: https://doi.org/${{needs.publish_zenodo.outputs.doi}}"
|
message: "The new version ${{ needs.version.outputs.new }} of TrainRuns.jl is available! DOI: https://doi.org/${{ needs.publish_zenodo.outputs.doi }} Further information at at ${{ needs.create_release.outputs.html_url }}."
|
||||||
visibility: "public" # default: public
|
visibility: "public" # default: public
|
||||||
env:
|
env:
|
||||||
MASTODON_URL: "https://fosstodon.org/"
|
MASTODON_URL: "https://fosstodon.org/"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
[deps]
|
[deps]
|
||||||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
||||||
TrainRuns = "e4541106-d44c-4e00-b50b-ecdf479fcf92"
|
TrainRuns = "e4541106-d44c-4e00-b50b-ecdf479fcf92"
|
||||||
|
|
||||||
|
[compat]
|
||||||
|
Documenter = "0.27"
|
||||||
|
|
|
@ -6,11 +6,11 @@ DocMeta.setdocmeta!(TrainRuns, :DocTestSetup, :(using TrainRuns); recursive=true
|
||||||
makedocs(;
|
makedocs(;
|
||||||
modules=[TrainRuns],
|
modules=[TrainRuns],
|
||||||
authors="Max Kannenberg, Martin Scheidt, and contributors",
|
authors="Max Kannenberg, Martin Scheidt, and contributors",
|
||||||
repo="https://github.com/railtoolkit/TrainRuns.jl/blob/{commit}{path}#{line}",
|
repo="https://www.railtoolkit.org/TrainRuns.jl//blob/{commit}{path}#{line}",
|
||||||
sitename="TrainRuns.jl",
|
sitename="TrainRuns.jl",
|
||||||
format=Documenter.HTML(;
|
format=Documenter.HTML(;
|
||||||
prettyurls=get(ENV, "CI", "false") == "true",
|
prettyurls=get(ENV, "CI", "false") == "true",
|
||||||
canonical="https://railtoolkit.github.io/TrainRuns.jl",
|
canonical="https://www.railtoolkit.org/TrainRuns.jl",
|
||||||
assets=String[],
|
assets=String[],
|
||||||
),
|
),
|
||||||
pages=[
|
pages=[
|
||||||
|
|
|
@ -2,13 +2,28 @@
|
||||||
CurrentModule = TrainRuns
|
CurrentModule = TrainRuns
|
||||||
```
|
```
|
||||||
|
|
||||||
# TrainRuns
|
# [TrainRuns.jl](https://github.com/railtoolkit/TrainRuns.jl) Documentation
|
||||||
|
|
||||||
Documentation for [TrainRuns](https://github.com/railtoolkit/TrainRuns.jl).
|
```@contents
|
||||||
|
|
||||||
```@index
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Public Functions
|
||||||
|
|
||||||
```@autodocs
|
```@autodocs
|
||||||
Modules = [TrainRuns]
|
Modules = [TrainRuns]
|
||||||
|
Private = false
|
||||||
|
```
|
||||||
|
|
||||||
|
## Privat Functions
|
||||||
|
|
||||||
|
```@autodocs
|
||||||
|
Modules = [TrainRuns]
|
||||||
|
Public = false
|
||||||
|
```
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
```@index
|
||||||
|
Modules = [TrainRuns]
|
||||||
|
Order = [:function, :type]
|
||||||
```
|
```
|
Loading…
Reference in New Issue