Skip to content

rj-v1.3.7

rj-v1.3.7 #33

Workflow file for this run

name: rencontredejeunesse.ch deploy
on:
release:
types: [published]
jobs:
deploy:
if: ${{ startsWith(github.event.release.tag_name, 'rj-') }}
runs-on: ubuntu-latest
env:
hodor_url: https://hodor.rencontredejeunesse.ch
hodor_key: rencontredejeunesse
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_version
# output "rj-v1.2.3" and "rj-v1_2_3"
run: |
echo ::set-output name=VERSION::$(echo ${GITHUB_REF/refs\/tags\//})
echo ::set-output name=VERSION_FILE::$(echo ${GITHUB_REF/refs\/tags\//} | tr . _)
echo "::set-output name=shortsha::$(git rev-parse --short ${GITHUB_SHA})"
echo "::set-output name=buildurl::${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
echo "::set-output name=date::$(date +'%d/%m/%y %H:%M')"
- uses: actions/setup-node@v2
with:
node-version: 18
- name: Install dependencies
run: |
npm ci
- name: Build
env:
APP_VERSION: ${{ steps.get_version.outputs.VERSION }}
BUILD_URL: ${{ steps.get_version.outputs.buildurl }}
SHORT_SHA: ${{ steps.get_version.outputs.shortsha }}
BUILD_DATE: ${{ steps.get_version.outputs.date }}
run: npm run build --if-present
- name: Create tar.gz
run: |
tar -czvf ${{ steps.get_version.outputs.VERSION_FILE }}.tar.gz dist
- name: Release
id: release_pub
# at this time of writing, the latest version does not contain the assets
# output
uses: softprops/action-gh-release@cd28b0f5ee8571b76cfdaa62a30d51d752317477
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ steps.get_version.outputs.VERSION_FILE }}.tar.gz
- name: Trigger deploy
run: |
curl -X POST -u hodor:${{ secrets.HODOR_PASSWORD }} -d "{\"browser_download_url\":\"${{ fromJSON(steps.release_pub.outputs.assets)[0].browser_download_url }}\",\"tag\":\"${{ steps.get_version.outputs.VERSION }}\"}" ${{ env.hodor_url }}/api/hook/${{ env.hodor_key }}