Skip to content

GitHub Actions workflow

Daniel Yates edited this page Feb 26, 2023 · 19 revisions

This is a guide on how to set up a GitHub workflow to run the packager automatically for your AddOns hosted on GitHub.

Only parts relevant to the packager project will be detailed here. For the full know-how on workflows, you can refer to the GitHub Docs on the matter and their docs for the full workflow syntax.

All of this can be done directly on GitHub, by clicking "Actions" on the project page for your AddOn, then "Skip this and set up a workflow yourself". You can also just create a file, e.g., .github/workflows/release.yml, in your project directory and edit that if you prefer your own tools.

The below example should be pretty self-explanatory. It's written in YAML, and aside from the annotations provided, the only thing to keep in mind are the environment variables needed to upload the packaged AddOn archive. These environment variables are detailed in the README of the packager, and need to be stored as "secrets" on your GitHub project page. Please follow this GitHub documentation on how to do that.

Important: The automatically-generated GITHUB_TOKEN secret must be configured with read-write permissions for your own repository to permit the packager to publish releases. Failure to do so will result in "Resource not accessible by integration" errors.

Annotated workflow example:

# description of this workflow, can be anything you want
name: Package and release

# we need to let GitHub know _when_ we want to release, typically only when we create a new tag.
# this will target only tags, and not all pushes to the master branch.
# this part can be heavily customized to your liking, like targeting only tags that match a certain word,
# other branches or even pullrequests.
on:
  push:
    tags:
      - '**'

# a workflow is built up as jobs, and within these jobs are steps
jobs:

  # "release" is a job, you can name it anything you want
  release:

    # we can run our steps on pretty much anything, but the "ubuntu-latest" image is a safe bet
    runs-on: ubuntu-latest

    # specify the environment variables used by the packager, matching the secrets from the project on GitHub
    env:
      CF_API_KEY: ${{ secrets.CF_API_KEY }}
      WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }}
      WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
      GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}  # "GITHUB_TOKEN" is a secret always provided to the workflow
                                                 # for your own token, the name cannot start with "GITHUB_"

    # "steps" holds a list of all the steps needed to package and release our AddOn
    steps:

      # we first have to clone the AddOn project, this is a required step
      - name: Clone project
        uses: actions/checkout@v3
        with:
          fetch-depth: 0  # gets entire git history, needed for automatic changelogs

      # once cloned, we just run the GitHub Action for the packager project
      - name: Package and release
        uses: BigWigsMods/packager@v2

      # another example where we supply additional arguments, this example is specifically to release
      # for the Wrath of the Lich King Classic version of the game and doesn't upload to WoWInterface
      - name: Package and release for Wrath of the Lich King Classic
        uses: BigWigsMods/packager@v2
        with:
          args: -g wrath -w 0

That's it, feel free to open an issue and tag @p3lim if you're having questions or issues specifically related to this.