Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
Run on release
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven65 committed Nov 30, 2023
1 parent b08b315 commit f87afee
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 107 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/create-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Create assets

on:
release:
types:
- published
- created

jobs:
build-assets:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20.6.0
- name: Run CI
if: ${{ hashFiles('package.json') != '' && hashFiles('package-lock.json') != '' }}
run: npm ci --no-progress --no-audit
- name: Run install
if: ${{ hashFiles('package.json') != '' && hashFiles('package-lock.json') == '' }}
run: npm install --no-progress --no-audit
- name: Run build
if: ${{ hashFiles('package-lock.json') != '' && hashFiles('gulp.js') == '' }}
run: npx --yes browserslist@latest --update-db && npm run build
- name: Run gulp
if: ${{ hashFiles('package-lock.json') != '' && hashFiles('gulp.js') != '' }}
run: gulp
- name: Create assets zip
uses: thedoctor0/zip-release@0.7.5
with:
type: zip
filename: '../assets.zip'
directory: dist
exclusions: '*.git* /*node_modules/* */source/sass/* */source/js/*'
- name: ls
run: ls -ahl
- name: Upload Assets
uses: helsingborg-stad/upload-artifact@1.0.0
with:
artifact: "assets.zip"
gh_token: ${{ secrets.GITHUB_TOKEN }}
release: ${{ github.event.release.tag_name }}
repo: ${{ github.repository }}
artifact_mime_type: application/zip

- name: Setup PHP
uses: shivammathur/setup-php@v2
if: ${{ hashFiles('composer.json') != '' }}
with:
tools: composer

- name: Build PHP
if: ${{ hashFiles('composer.json') != '' }}
run: |
composer install --prefer-dist --no-progress --no-dev
composer dump-autoload
- name: Process removables
run: |
removables=('.git'
'.gitignore'
'.github'
'.gitattributes'
'build.php'
'.npmrc'
'composer.json'
'composer.lock'
'env-example'
'webpack.config.js'
'package-lock.json'
'package.json'
'phpunit.xml.dist'
'README.md'
'gulpfile.js'
'./node_modules/'
'./source/sass/'
'./source/js/'
'LICENSE'
'babel.config.js'
'yarn.lock'
)
for item in ${removables[@]}; do rm -rf $item; done;
- name: Create release zip
uses: thedoctor0/zip-release@0.7.5
with:
type: zip
filename: 'release.zip'
exclusions: '*.git* /*node_modules/* */source/sass/* */source/js/*'

- name: Upload release
uses: helsingborg-stad/upload-artifact@1.0.0
with:
artifact: "release.zip"
gh_token: ${{ secrets.GITHUB_TOKEN }}
release: ${{ github.event.release.tag_name }}
repo: ${{ github.repository }}
artifact_mime_type: application/zip
118 changes: 11 additions & 107 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,114 +5,18 @@ on:
branches: [main]

jobs:
# release:
# runs-on: ubuntu-latest

# steps:

# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0

# - name: Create Release and bump version files
# uses: helsingborg-stad/release-wp-plugin-action@1.0.2
# with:
# php-version: 8.2
# node-version: 20.6.0

build-assets:
# needs: ['release']
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20.6.0
- name: Run CI
if: ${{ hashFiles('package.json') != '' && hashFiles('package-lock.json') != '' }}
run: npm ci --no-progress --no-audit
- name: Run install
if: ${{ hashFiles('package.json') != '' && hashFiles('package-lock.json') == '' }}
run: npm install --no-progress --no-audit
- name: Run build
if: ${{ hashFiles('package-lock.json') != '' && hashFiles('gulp.js') == '' }}
run: npx --yes browserslist@latest --update-db && npm run build
- name: Run gulp
if: ${{ hashFiles('package-lock.json') != '' && hashFiles('gulp.js') != '' }}
run: gulp
- name: Create assets zip
uses: thedoctor0/zip-release@0.7.5
with:
type: zip
filename: '../assets.zip'
directory: dist
exclusions: '*.git* /*node_modules/* */source/sass/* */source/js/*'
- name: ls
run: ls -ahl
- name: Upload Assets
uses: helsingborg-stad/upload-artifact@1.0.0
with:
artifact: "assets.zip"
gh_token: ${{ secrets.GITHUB_TOKEN }}
release: ${{ github.event.release.tag_name }}
repo: ${{ github.repository }}
artifact_mime_type: application/zip

- name: Setup PHP
uses: shivammathur/setup-php@v2
if: ${{ hashFiles('composer.json') != '' }}
with:
tools: composer

- name: Build PHP
if: ${{ hashFiles('composer.json') != '' }}
run: |
composer install --prefer-dist --no-progress --no-dev
composer dump-autoload
steps:

- name: Process removables
run: |
removables=('.git'
'.gitignore'
'.github'
'.gitattributes'
'build.php'
'.npmrc'
'composer.json'
'composer.lock'
'env-example'
'webpack.config.js'
'package-lock.json'
'package.json'
'phpunit.xml.dist'
'README.md'
'gulpfile.js'
'./node_modules/'
'./source/sass/'
'./source/js/'
'LICENSE'
'babel.config.js'
'yarn.lock'
)
for item in ${removables[@]}; do rm -rf $item; done;
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create release zip
uses: thedoctor0/zip-release@0.7.5
with:
type: zip
filename: 'release.zip'
exclusions: '*.git* /*node_modules/* */source/sass/* */source/js/*'

- name: Upload release
uses: helsingborg-stad/upload-artifact@1.0.0
with:
artifact: "release.zip"
gh_token: ${{ secrets.GITHUB_TOKEN }}
release: ${{ github.event.release.tag_name }}
repo: ${{ github.repository }}
artifact_mime_type: application/zip
- name: Create Release and bump version files
uses: helsingborg-stad/release-wp-plugin-action@1.0.2
with:
php-version: 8.2
node-version: 20.6.0

0 comments on commit f87afee

Please sign in to comment.