Update main.yml #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SCSS Lint, Compile, and Package | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: cd private && yarn | |
- name: Compile SCSS to CSS | |
run: cd private && yarn build | |
- name: Delete Existing Release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const tagName = 'playground'; | |
const { owner, repo } = context.repo; | |
try { | |
const release = await github.rest.repos.getReleaseByTag({ | |
owner: owner, | |
repo: repo, | |
tag: tagName | |
}); | |
if (release) { | |
await github.rest.repos.deleteRelease({ | |
owner: owner, | |
repo: repo, | |
release_id: release.data.id | |
}); | |
console.log(`Deleted release with tag ${tagName}.`); | |
await github.rest.git.deleteRef({ | |
owner: owner, | |
repo: repo, | |
ref: `tags/${tagName}` | |
}); | |
console.log(`Deleted tag ${tagName}.`); | |
} | |
} catch (error) { | |
if (error.status === 404) { | |
console.log(`Release with tag ${tagName} not found.`); | |
} else { | |
console.error(`Error deleting release: ${error.message}`); | |
throw error; | |
} | |
} | |
- name: Archive production artifacts | |
run: cd wp-content/themes && zip -r ../../humanity-theme-playground.zip ./humanity-theme | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: humanity-theme-playground-zip | |
path: humanity-theme-playground.zip | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE2 }} | |
with: | |
tag_name: 'playground' # Adjust the tag name as needed | |
release_name: 'Playground Theme Release' | |
body: 'Release of the Humanity Theme for WordPress Playground' | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE2 }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./humanity-theme-playground.zip | |
asset_name: humanity-theme-playground.zip | |
asset_content_type: application/zip | |
# add POMO file support |