Merge pull request #83 from pantheon-systems/v1.2.0 #11
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: Build release artifact | |
#on: | |
# release: | |
# types: [ released ] | |
env: | |
EXCLUDES: ${{ '"**/node_modules/*" "**/assets/js/*" "**/assets/css/*" "**/*.md" "**/.git/*" "**/.github/*" "**/.gitignore" "**/composer.lock" "**/composer.json" "**/package.json" "**/package-lock.json" "**/phpcs.xml" "**/tailwind.config.js" "**/webpack.mix.js" "**/.eslintrc" "**/phpunit.xml.dist" "**/bin/*" "**/tests/*" "**/dist/*.txt"' }} | |
jobs: | |
build_artifact: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set repo name environment variable | |
id: set-repo-variable | |
run: echo "REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f 2)" >> $GITHUB_ENV | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::vendor" | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Add Composer dependency credentials | |
run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json | |
- name: Install PHP dependencies | |
id: composer-install | |
run: composer install --no-dev | |
- name: Dump autoload files | |
id: composer-dump | |
run: composer dump-autoload -o | |
- name: Get NPM Cache Directory | |
id: npm-cache | |
run: | | |
echo "::set-output name=dir::node_modules" | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- uses: actions/setup-node@v2-beta | |
with: | |
node-version: '12' | |
check-latest: true | |
- name: Install NPM dependencies | |
id: npm-install | |
run: npm install | |
- name: Build production assets | |
id: npm-build | |
run: npm run prod | |
- name: Build artifact | |
id: build-artifact | |
env: | |
ZIP: ${{ env.REPO }}.zip | |
DIR: ${{ env.REPO }} | |
run: cd .. && zip -r ${{ env.ZIP }} ${{ env.DIR }} -x ${{ env.EXCLUDES }} | |
- name: Upload artifact | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ../${{ env.REPO }}.zip | |
asset_name: ${{ env.REPO }}.zip | |
asset_content_type: application/zip |