Update actions #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deployment | |
on: | |
workflow_dispatch: | |
push: | |
branches: '*' | |
jobs: | |
deploy: | |
if: ${{ !(github.event_name == 'push') || contains(github.event.head_commit.message, '[deploy]') }} | |
runs-on: ubuntu-latest | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: julia-actions/setup-julia@v1 | |
with: | |
version: '1.10' | |
- name: Create distribution directories | |
run: | | |
cd $GITHUB_WORKSPACE | |
mkdir -p ./dist/build/ | |
mkdir -p ./dist/cache/ | |
- name: Retrieve Last Release Tag | |
run: | | |
cd $GITHUB_WORKSPACE | |
LAST_TAG="$(gh release view | sed -nr 's/tag:\s*(v\S*)/\1/p')" | |
echo "$LAST_TAG" >> ./dist/build/last.tag | |
- name: Build and Deploy QUBOLib | |
run: | | |
cd $GITHUB_WORKSPACE | |
julia --proj=./scripts/build -e 'import Pkg; Pkg.develop(path=@__DIR__)' | |
julia --proj=./scripts/build ./scripts/build/script.jl --clear-build --deploy | |
- name: Load Next Release Tag | |
run: | | |
cd $GITHUB_WORKSPACE | |
NEXT_TAG="$(cat $GITHUB_WORKSPACE/dist/build/next.tag)" | |
echo "NEXT_TAG=$NEXT_TAG" >> $GITHUB_ENV | |
- name: Write release title | |
run: | | |
TITLE="$(cat $GITHUB_WORKSPACE/dist/build/title.txt)" | |
echo "TITLE=$TITLE" >> $GITHUB_ENV | |
- name: Publish QUBOLib data release | |
run: > | |
gh release create $NEXT_TAG | |
--latest | |
--notes-file "$GITHUB_WORKSPACE/dist/build/NOTES.md" | |
--title "$TITLE" | |
--target $GITHUB_SHA | |
$GITHUB_WORKSPACE/dist/build/qubolib.tar.gz | |
# - name: Update Documentation | |
# run: | | |
# git config user.name "github-actions" | |
# git config user.email "github-actions@github.com" | |
# git add "./*README.md" | |
# git commit --allow-empty -m "Update Documentation" | |
# git push | |
- name: Clean up old mirror release | |
run: | | |
gh release delete "mirror-data" --yes || true | |
git push origin --delete "refs/tags/mirror-data" || true | |
- name: Switch to mirror branch | |
run: git checkout origin mirror | |
- name: Publish mirror release | |
run: > | |
gh release create "mirror-data" | |
--prerelease | |
--notes-file "$GITHUB_WORKSPACE/dist/build/mirror/NOTES.md" | |
--title "$SUBJECT" | |
--target $GITHUB_SHA | |
$GITHUB_WORKSPACE/dist/build/mirror/*.zip |