Update build&deploy.yml #50
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
flpersname: Juno (build & deploy) | ||
Check failure on line 1 in .github/workflows/build&deploy.yml GitHub Actions / .github/workflows/build&deploy.ymlInvalid workflow file
|
||
on: | ||
push: | ||
branches: | ||
- gh-ci | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
# On release creation | ||
# release: | ||
# types: [created] | ||
env: | ||
ASSET_NAME: exampleapp | ||
ASSET_TYPE: app | ||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "build-and-publish-asset" | ||
cancel-in-progress: true | ||
# Default to bash | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
build-and-deploy: | ||
runs-on: [ubuntu-latest] | ||
env: | ||
ACTIONS_RUNNER_DEBUG: true | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
${{ env.ASSET_TYPE == "app" && "libs" || "" }} | ||
apps | ||
scripts | ||
helpers | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: "@${{ github.repository_owner }}" | ||
- name: build libs | ||
run: | | ||
ls -la | ||
# install npm packages | ||
npm install | ||
# build libs if asset type is "app" | ||
if [ "$ASSET_TYPE" = "app" ] || [ "$ASSET_TYPE" = "apps" ]; then npm run build-libs; fi | ||
- name: build asset | ||
run: | | ||
# replace | ||
jq '.name = "@${{ github.repository_owner }}/exampleapp" | .private = false' \ | ||
./apps/exampleapp/package.json > "/tmp/test.json" && \ | ||
mv /tmp/test.json ./apps/exampleapp/package.json | ||
npm -w @${{ github.repository_owner }}/exampleapp run build | ||
- name: Publish to github packages | ||
run: | | ||
# copy generated .npmrc to repository | ||
cp $NPM_CONFIG_USERCONFIG ./ | ||
# publish to https://github.com/${{ github.repository_owner }}/packages | ||
npm -w @${{ github.repository_owner }}/exampleapp publish #--dry-run | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |