shlink-web-client/.github/workflows/deploy-preview.yml

39 lines
1.2 KiB
YAML
Raw Normal View History

name: Deploy preview
on:
pull_request: null
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-20.04
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use node.js 14.15
uses: actions/setup-node@v1
with:
node-version: 14.15
- name: Generate slug
id: generate_slug
run: echo "##[set-output name=slug;]$(echo ${GITHUB_REF#refs/heads/} | sed -r 's/[~\^]+//g' | sed -r 's/[^a-zA-Z0-9]+/-/g' | sed -r 's/^-+\|-+$//g' | tr A-Z a-z)"
- name: Build
run: |
npm ci && \
node ./scripts/set-homepage.js /shlink-web-client/${{ steps.generate_slug.outputs.slug }} && \
npm run build
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.1
with:
branch: preview-env
folder: build
target-folder: ${{ steps.generate_slug.outputs.slug }}
- name: Publish env
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Preview environment
message: "**Preview environment**: https://shlinkio.github.io/shlink-web-client/${{ steps.generate_slug.outputs.slug }}"