Open jaredhowland opened 1 year ago
I've updated this a little because the zip file wasn't zipping the top-level directory:
name: Release
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: "Checkout repository"
uses: "actions/checkout@master"
with:
path: "{MODULE_NAME}/"
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "latest"
- name: "Composer install"
uses: "ramsey/composer-install@v2"
with:
working-directory: "{MODULE_NAME}/"
composer-options: "--ignore-platform-reqs --optimize-autoloader"
- name: "Create archive release"
uses: "thedoctor0/zip-release@master"
with:
filename: "{MODULE_NAME}.zip"
exclusions: "{MODULE_NAME}/*.git* {MODULE_NAME}/UpdateModuleIni.php {MODULE_NAME}/.editorconfig {MODULE_NAME}/.scrutinizer.yml {MODULE_NAME}/CODE_OF_CONDUCT.md {MODULE_NAME}/CONTRIBUTING.md {MODULE_NAME}/CONTRIBUTORS.md {MODULE_NAME}/RELEASE.md {MODULE_NAME}/phpcs.xml.dist"
- name: "Upload Release"
uses: "ncipollo/release-action@v1"
with:
artifacts: "{MODULE_NAME}.zip"
bodyFile: "{MODULE_NAME}/RELEASE.md"
token: ${{ secrets.GITHUB_TOKEN }}
Github now allows you to use actions that could create a release and attach a zipped version of the module for you. Putting an example action in the documentation (
docs/register_an_addon.md
) might be very helpful. Here is the one I use for the Any Cloud module. You create a tag with the version of the module you want to create a release for (v2.2.3 for example) and the action takes over from there:.github/workflows/release.yml
It downloads composer, installs the versions of the dependencies indicated in your
composer.lock
file in the repository, zips everything up except what you put in theexclusions
section, and adds the text ofRELEASE.md
as the text of the release.In any case, this might be helpful to other developers and make things a little easier than manually uploaded a
.zip
file to every release. Creating agit
tag for a release and letting GitHub do all the other work is really helpful.