Skip to content

Instantly share code, notes, and snippets.

@gesslar
Created June 20, 2024 21:50
Show Gist options
  • Save gesslar/ae50e2f31efdf9d350f8fb3f93f1306e to your computer and use it in GitHub Desktop.
Save gesslar/ae50e2f31efdf9d350f8fb3f93f1306e to your computer and use it in GitHub Desktop.
GitHub workflow for automatically compiling and creating a release whenever you push to GitHub, except from PRs
name: Build project using muddler and upload artifact
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3.3.0
- name: JSON to variables
# see https://github.com/antifree/json-to-variables
# You may pin to the exact commit or the version.
# uses: antifree/json-to-variables@cc8c6394031e145c90f7f9ec909d83df92431fb8
uses: antifree/json-to-variables@v1.2.0
with:
# The json file.
filename: "./mfile"
# The prefix for variables.
prefix: "mfile"
- name: "create version.txt"
uses: 1arp/create-a-file-action@0.4.5
# see https://github.com/marketplace/actions/create-a-file
with:
path: './'
isAbsolutePath: false
file: 'version.txt'
content: ${{ env.mfile_version }}
- name: Build With Muddler
# You may pin to the exact commit or the version.
# uses: demonnic/build-with-muddler@a9355b3c4f93553287e0f2d4087508b9f6164225
uses: demonnic/build-with-muddler@v1.4
with:
# Version of muddler to use
muddlerVersion: LATEST # optional, default is LATEST
# What directory to run muddler in.
#workingDir: # optional, default is ${{ github.workspace }}
- uses: ncipollo/release-action@v1
# see https://github.com/marketplace/actions/create-release
with:
artifacts: "build/${{env.mfile_package}}.mpackage,version.txt"
allowUpdates: true
bodyFile: "./README.md"
tag: ${{ env.mfile_version }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment