2021-05-09 14:34:39 +03:00
|
|
|
name: Deploy preview
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request: null
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-20.04
|
2021-05-09 14:53:36 +03:00
|
|
|
continue-on-error: true
|
2021-05-09 14:34:39 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Use node.js 14.15
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 14.15
|
2021-05-09 14:53:36 +03:00
|
|
|
- name: Generate slug
|
|
|
|
id: generate_slug
|
2021-05-09 15:03:59 +03:00
|
|
|
run: echo "##[set-output name=slug;]$(echo ${GITHUB_HEAD_REF#refs/heads/} | sed -r 's/[~\^]+//g' | sed -r 's/[^a-zA-Z0-9]+/-/g' | sed -r 's/^-+\|-+$//g' | tr A-Z a-z)"
|
2021-05-09 14:34:39 +03:00
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
npm ci && \
|
2021-05-09 14:53:36 +03:00
|
|
|
node ./scripts/set-homepage.js /shlink-web-client/${{ steps.generate_slug.outputs.slug }} && \
|
2021-05-09 14:34:39 +03:00
|
|
|
npm run build
|
|
|
|
- name: Deploy
|
|
|
|
uses: JamesIves/github-pages-deploy-action@4.1.1
|
|
|
|
with:
|
2021-05-09 15:10:05 +03:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2021-05-09 14:34:39 +03:00
|
|
|
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 }}"
|