Lib release workflow test #92
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: Check and build modules | |
on: | |
push: | |
branches: [ master, ver/* ] | |
pull_request: | |
workflow_dispatch: | |
env: | |
VERSION: '1.20' | |
COMMIT_MSG: ${{ github.event.head_commit.message }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: mcbeet/check-commands@v1 | |
with: | |
minecraft: '1.19' # temp manual assignment. mecha does not support 1.19.4 as valid version. ${{ env.VERSION }} | |
source: base gm4_* lib_* | |
version: '0.67.0' | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.event_name != 'pull_request' && 'release' || format('pr-{0}', github.event.number) }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Checkout release branch | |
if: github.event_name != 'pull_request' | |
uses: actions/checkout@v2 | |
with: | |
ref: release | |
path: release | |
- name: Fetch pull request base | |
if: github.event_name == 'pull_request' | |
run: git fetch origin ${{ github.base_ref }} | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1.2.1 | |
with: | |
virtualenvs-in-project: true | |
- name: Setup cache | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install | |
- name: Build and publish all modules | |
if: github.event_name != 'pull_request' | |
run: poetry run beet -p beet-release.yaml -l ${{ env.LOG_LEVEL }} build | |
env: | |
BEET_MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
BEET_SMITHED_TOKEN: ${{ secrets.SMITHED_TOKEN }} | |
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}} | |
- name: Build all modules for pull request | |
if: github.event_name == 'pull_request' | |
run: poetry run beet -p beet-release.yaml -l ${{ env.LOG_LEVEL }} build | |
env: | |
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}} | |
- name: Upload artifact | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'Modules for pull request #${{ github.event.number }}' | |
path: ${{ github.workspace }}/release/${{ env.VERSION }}/ | |
- name: Commit release | |
if: github.event_name != 'pull_request' | |
run: | | |
git config --global user.email "${{ github.event.head_commit.author.email }}" | |
git config --global user.name "${{ github.event.head_commit.author.username }}" | |
cd release | |
git add . | |
git commit -m "🚀 ${{ github.event.after }} $COMMIT_MSG" | |
- name: Push release | |
if: github.event_name != 'pull_request' | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
directory: release | |
branch: release |