Skip to content

Instantly share code, notes, and snippets.

@kawzar
Created May 2, 2022 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawzar/fda438e45c7e18d900e185ae1bfd1799 to your computer and use it in GitHub Desktop.
Save kawzar/fda438e45c7e18d900e185ae1bfd1799 to your computer and use it in GitHub Desktop.
name: Build project
on:
workflow_dispatch:
pull_request:
types: [closed]
jobs:
buildForWebGL: [...]
uploadToFTP:
name: Upload to FTP
runs-on: ubuntu-latest
needs: buildForWebGL
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Download build artifact
uses: actions/download-artifact@v1
with:
name: build-${{ steps.date.outputs.date }}-${{ github.run_id }}
path: build/WebGL
- name: Upload via FTP
uses: isthatcentered/dist-to-ftp@master
with:
host: ${{ secrets.FTP_SERVER }}
user: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
path: build/WebGL
into: ${{steps.extract_branch.outputs.branch}}\${{ steps.date.outputs.date }}
discordMessage:
name: Send message to discord
runs-on: ubuntu-latest
needs: uploadToFTP
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Send Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: 'The project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed. New Build URL: https://example.com/${{steps.extract_branch.outputs.branch}}/${{ steps.date.outputs.date }}/WebGL'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment