Skip to content

Publication pipeline #6

Publication pipeline

Publication pipeline #6

name: publish-release
on:
workflow_dispatch: ## DEBUG
push:
branches: ["main"]
pull_request:
branches: ["main"]
# FIXME: to uncomment when ready for deploy
# on:
# release:
# types: [published]
# workflow_dispatch:
jobs:
################################################################################
## Building
################################################################################
## FIXME: uncomment when ready for deploy
# sync-version:
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v2
# - name: Install Python and pythonnet
# uses: actions/setup-python@v2
# with:
# python-version: '3.9.10'
# - name: Install Python dependencies
# run: |
# python -m pip install --upgrade pip
# pip install invoke
# - name: Update the version across the project and commit the changes
# run: invoke versionize
# - name: Install GitHub CLI
# run: |
# choco install gh
# - name: Authenticate GitHub CLI
# run: |
# echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
# - name: Create a new branch and commit the version change
# # Delete branch remotely version-sync-branch (if exists)
# run: |
# git fetch --prune
# if git branch -r | grep -q 'origin/version-sync-branch'; then
# git push origin --delete version-sync-branch
# else
# echo "Branch version-sync-branch does not exist."
# fi
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# shell: bash
# # Create new branch and commit version change
# - run: |
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global user.name "github-actions[bot]"
# git checkout -b version-sync-branch
# git commit -am "ACTION_BOT: Sync version for release"
# git push --set-upstream origin version-sync-branch
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # Close existing pull requests for version-sync-branch
# - run: |
# gh pr list --state open --head version-sync-branch --json number --jq '.[].number' | ForEach-Object { gh pr close $_ }
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# shell: pwsh
# # Create pull request
# - run: |
# gh pr create --title "ACTION_BOT: Sync version for release" --body "Sync version for release" --base main --head version-sync-branch --label ACTION_BOT
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # Merge pull request
# - run: |
# $pr = gh pr list --head version-sync-branch --json number --jq '.[0].number'
# gh pr merge $pr --squash --delete-branch --admin
# env:
# GITHUB_TOKEN: ${{ secrets.DF_COBOT_PAT_TOKEN }}
# shell: pwsh
build-ghusers:
runs-on: windows-latest
# needs: sync-version # FIXME: uncomment when ready for deploy
steps:
- uses: actions/checkout@v2
- uses: NuGet/[email protected]
- name: Install CPython and pythonnet package
run: |
choco install python --version=3.9.10
python -m pip install pythonnet==3.0.3
python -m pip install invoke
# - uses: ./.github/actions/gh-action-componentizer
# with:
# source: src/gh/components
# target: build/gh
- name: create the build folder
run: mkdir build
- name: Flag the ghuser codes with the correct package version
run: invoke flagerize
- name: Invoke the componentizer
run: |
mkdir build/gh
invoke ghcomponentize
- uses: actions/upload-artifact@v4
with:
name: ghuser-components
path: build/gh
build-yak-package:
runs-on: windows-latest
needs: build-ghusers
steps:
- uses: actions/checkout@v2
- name: Install Python and pythonnet
uses: actions/setup-python@v2
with:
python-version: '3.9.10'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install invoke
pip install pythonnet
- name: Download the ghuser components
uses: actions/download-artifact@v4
with:
name: ghuser-components
path: build/gh
- name: Build the yak package
run: invoke yakerize
- name: Save artifact the yak package as an artifact
uses: actions/upload-artifact@v4
with:
name: yak_package_artifact
path: build/yak/*.yak
################################################################################
## Publishing
################################################################################
publish_yak:
needs: build-yak-package
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
# with:
# ref: main # FIXME: to be uncommented when ready for deploy
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: yak_package_artifact
path: build/yak
- name: Publish to Yak test server
run: |
$YAK_FILE=$(ls *.yak)
echo "Yak file: $YAK_FILE"
..\..\invokes\yaker\exec\Yak.exe push --source https://test.yak.rhino3d.com $YAK_FILE
working-directory: build/yak
env:
YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}
continue-on-error: true
- name: Verify the Yak test package
run: |
..\..\invokes\yaker\exec\Yak.exe search --source https://test.yak.rhino3d.com --all --prerelease script-sync
working-directory: build/yak
env:
YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}
# FIXME: to uncomment when ready for deploy
# - name: Publish to Yak server
# run: |
# $YAK_FILE=$(ls *.yak)
# echo "Yak file: $YAK_FILE"
# ..\..\invokes\yaker\exec\Yak.exe push $YAK_FILE
# working-directory: build/yak
# env:
# YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}
# # check the real release
# - name: Verify the Yak test package
# run: |
# ..\..\invokes\yaker\exec\Yak.exe search --all --prerelease script-sync
# working-directory: build/yak
# env:
# YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}