Skip to content

Update publish.yml #155

Update publish.yml

Update publish.yml #155

Workflow file for this run

name: Publish
on: [push, pull_request]
jobs:
set_nightly_tag:
name: Set nightly tag on dev
if: startsWith(github.ref, 'refs/heads/dev')
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: Show all tags
run: git tag
- name: Set commit info
run: |
git config user.name "Automated Release"
git config user.email "automated@release.com"
- name: Remove old nightly tag
run: git tag --delete nightly || true
- name: Set new nightly tag
run: 'git tag --annotate nightly -m "+$(git rev-list --count origin/master..HEAD) commits
CAUTION: Nightlies are untested alpha releases. Most users should use ''$(git describe --tags --exclude=nightly --abbrev=0)''!
$(git log --format=''%an: %s (%h)'' origin/master..HEAD | grep -v ''Merge pull request'')"'
- name: Show created tag
run: |
git show nightly
- name: Remove remote tag
run: git push --delete origin nightly || true
- name: Push tag to remote
run: git push --tags
build_editor:
name: Build ${{ matrix.editor.name }}-${{ matrix.cfg.prefix }}
runs-on: ${{ matrix.cfg.os }}
strategy:
matrix:
cfg:
- {os: ubuntu-22.04, prefix: 'linux', suffix: '', architecture: 'x64'}
- {os: windows-2019, prefix: 'win64', suffix: '.exe', architecture: 'x64'}
- {os: macos-latest, prefix: 'osx', suffix: '', architecture: 'x64'}
editor:
- {name: 'smb3-foundry'}
- {name: 'smb3-scribe'}
steps:
- name: Check out
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
architecture: ${{ matrix.cfg.architecture }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Get Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pyinstaller
- name: Ubuntu Only
if: ${{ matrix.cfg.prefix == 'linux' }}
run: |
sudo apt-get update
sudo apt-get install -y libegl1 libxcb-shape0 libqt5gui5
- name: Build Executable
run: |
pyinstaller ${{ matrix.editor.name }}.spec
mv dist/${{ matrix.editor.name }}${{ matrix.cfg.suffix }} dist/${{ matrix.cfg.prefix }}-${{ matrix.editor.name }}${{ matrix.cfg.suffix }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.cfg.prefix }}-${{ matrix.editor.name }}${{ matrix.cfg.suffix }}
path: dist/${{ matrix.cfg.prefix }}-${{ matrix.editor.name }}${{ matrix.cfg.suffix }}
build_manual:
name: Build Manual
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Get Dependencies
run: |
sudo apt-get update
sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra
- name: Build PDFs
run: |
pushd manual/foundry/
pandoc foundry-manual.md -o manual-foundry.pdf
popd
pushd manual/scribe/
pandoc scribe-manual.md -o manual-scribe.pdf
popd
- name: Upload Foundry Manual
uses: actions/upload-artifact@v2
with:
path: manual/foundry/manual-foundry.pdf
name: manual-foundry
- name: Upload Scribe Manual
uses: actions/upload-artifact@v2
with:
path: manual/scribe/manual-scribe.pdf
name: manual-scribe
# We're forced to create a separate publish job since the create-release
# action fails if it is run twice on the same tag. But we have multiple
# build systems (Windows, Linux, OSX) and only want one release.
publish:
needs: [build_editor, build_manual]
name: "Publish"
runs-on: ubuntu-latest # this doesn't matter as it's only codestyle and artifact collection
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
architecture: x64
- name: Set environment tag name
id: tag_name
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Set release information
id: release_info
run: |
echo ::set-output name=RELEASE_NAME::"$(git tag --format="%(body)" --points-at ${{ steps.tag_name.outputs.SOURCE_TAG }} | head -n 1)"
git tag --format="%(body)" --points-at ${{ steps.tag_name.outputs.SOURCE_TAG }}
echo ::set-output name=RELEASE_BODY::"$(git tag --format="%(body)" --points-at ${{ steps.tag_name.outputs.SOURCE_TAG }} | head -n +3)"
- name: Check for correct tag
run: python3.11 .ci-tag-check.py
env:
TAG_NAME: ${{ steps.tag_name.outputs.SOURCE_TAG }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: nightly
body: ${{ steps.release_info.outputs.RELEASE_BODY }}
draft: false
prerelease: ${{ steps.tag_name.outputs.SOURCE_TAG == 'nightly' }}
- name: Download All Artifacts
uses: actions/download-artifact@v2
with:
path: ./artifacts/
# upload-release-asset doesn't accept a directory or an array
# of files, so we must individually upload each one
- name: Upload SMB3 Foundry Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/linux-smb3-foundry/linux-smb3-foundry"
asset_name: "linux-smb3-foundry"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry OSX
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/osx-smb3-foundry/osx-smb3-foundry"
asset_name: "osx-smb3-foundry"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/win64-smb3-foundry.exe/win64-smb3-foundry.exe"
asset_name: "win64-smb3-foundry.exe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Scribe Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/linux-smb3-scribe/linux-smb3-scribe"
asset_name: "linux-smb3-scribe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Scribe OSX
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/osx-smb3-scribe/osx-smb3-scribe"
asset_name: "osx-smb3-scribe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Scribe Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/win64-smb3-scribe.exe/win64-smb3-scribe.exe"
asset_name: "win64-smb3-scribe.exe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry Manual
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/manual-foundry/manual-foundry.pdf"
asset_name: "manual-foundry.pdf"
asset_content_type: application/pdf
- name: Upload SMB3 Scribe Manual
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/manual-scribe/manual-scribe.pdf"
asset_name: "manual-scribe.pdf"
asset_content_type: application/pdf