Skip to content

bullenetwork-v2.2.2 #111

bullenetwork-v2.2.2

bullenetwork-v2.2.2 #111

name: bullenetwork.ch deploy
on:
release:
types: [published]
jobs:
deploy:
if: ${{ startsWith(github.event.release.tag_name, 'bullenetwork-') }}
runs-on: ubuntu-latest
env:
base_folder: bullenetwork.ch
hodor_url: https://hodor.doxatech.ch
hodor_key: bullenetwork
defaults:
run:
working-directory: ./${{ env.base_folder }}
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_version
# output "bullenetwork-v1.2.3" and "bullenetwork-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: 15
- name: Install dependencies
run: |
npm install
npm install -g gatsby-cli@2.8.29
- name: Build
env:
GATSBY_GCS_AUTH_ENDPOINT: https://gcsauth.bullenetwork.ch/api/auth
GATSBY_GCS_ARCHIVE_ENDPOINT: https://gcsauth.bullenetwork.ch/api/archive
GATSBY_DIRECTUS_ENDPOINT: https://vanil.bullenetwork.ch
GATSBY_APP_VERSION: ${{ steps.get_version.outputs.VERSION }}
GATSBY_BUILD_URL: ${{ steps.get_version.outputs.buildurl }}
GATSBY_SHORT_SHA: ${{ steps.get_version.outputs.shortsha }}
GATSBY_BUILD_DATE: ${{ steps.get_version.outputs.date }}
run: gatsby build
- name: Create tar.gz
run: |
tar -czvf ${{ steps.get_version.outputs.VERSION_FILE }}.tar.gz public
- 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 }}