I am having issues wrapping my head around GitHub actions. I currently use WPack.io to build and create a distributable .zip archive of my WordPress theme. I want to be able to take this .zip and have it at the top level as a release asset upon creating a release in GitHub. Currently if I locally run the build and archive commands, it will create a .zip of my theme in the /builds directory. I understand I can use these commands in GitHub actions upon a release, however I am stuck with the part where I would be able to move /builds/theme.zip up to the top level. Here is what I have so far.
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install dependencies
run: |
npm install
- name: Run WPack Build
run: |
npm run build
- name: Run WPack Archive
run: |
npm run archive
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.event.repository.name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}