Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module documentation enhancement #69

Open
jaredhowland opened this issue Sep 30, 2023 · 1 comment
Open

Module documentation enhancement #69

jaredhowland opened this issue Sep 30, 2023 · 1 comment

Comments

@jaredhowland
Copy link
Contributor

jaredhowland commented Sep 30, 2023

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

name: Release
on:
  push:
    tags:
      - '*'
jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: "Checkout repository"
        uses: "actions/checkout@master"
      - name: "Set up PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          php-version: "latest"
      - name: "Composer install"
        uses: "ramsey/composer-install@v2"
        with:
          composer-options: "--ignore-platform-reqs --optimize-autoloader"
      - name: "Create archive release"
        uses: "thedoctor0/zip-release@master"
        with:
          filename: "{AddonZipName}.zip"
          exclusions: "*.git* .tx/ language/*.po* .editorconfig phpcs.xml.dist"
      - name: Upload Release
        uses: ncipollo/release-action@v1
        with:
          artifacts: '{AddonZipName}.zip'
          bodyFile: "RELEASE.md"
          token: ${{ secrets.GITHUB_TOKEN }}

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 the exclusions section, and adds the text of RELEASE.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 a git tag for a release and letting GitHub do all the other work is really helpful.

@jaredhowland
Copy link
Contributor Author

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 }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant