Skip to content

bullenetwork-v2.2.2 #97

bullenetwork-v2.2.2

bullenetwork-v2.2.2 #97

name: o2vie-chatel.ch deploy
on:
release:
types: [published]
jobs:
deploy:
if: ${{ startsWith(github.event.release.tag_name, 'o2vie-') }}
runs-on: ubuntu-latest
env:
base_folder: o2vie-chatel.ch_v2
hodor_url: https://hodor.doxatech.ch
hodor_key: o2vie
o2vie_directus: https://vanil.bullenetwork.ch
defaults:
run:
working-directory: ./${{ env.base_folder }}
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_version
# output "o2vie-v1.2.3" and "o2vie-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 }}
PUBLIC_DIRECTUS_ENDPOINT: ${{ env.o2vie_directus }}
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: ${{ env.base_folder }}/${{ 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 }}