Skip to content

Update main.yml

Update main.yml #53

Workflow file for this run

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/humanity-theme && zip -r ../../../../ ./*
- 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