fix secrets #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- "dev" | |
- "main" | |
jobs: | |
deploy: | |
if: github.event.pull_request.merged == true | |
runs-on: self-hosted | |
environment: ${{ github.base_ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download the table | |
if: github.base_ref == 'main' | |
run: curl -L "docs.google.com/spreadsheets/d/${{ secrets.SHEET_ID }}/gviz/tq?tqx=out:csv&sheet=Ukrainian" -o table.csv | |
- uses: dawidd6/action-download-artifact@v2 | |
with: | |
pr: ${{github.event.pull_request.number}} | |
workflow: CI.yml | |
name: executable | |
skip_unpack: true | |
# path: bin/bot | |
- run: unzip executable.zip -d bin | |
- name: Restart bot | |
env: | |
TELOXIDE_TOKEN: ${{ secrets.TELOXIDE_TOKEN }} | |
run: | | |
docker build -t first_aid_bot:${{ github.base_ref == 'main' && 'main' || 'dev' }} . | |
docker compose -f docker-compose_${{ github.base_ref == 'main' && 'main' || 'dev' }}.yml -p ${{ github.base_ref == 'main' && 'main' || 'dev' }}_bot up -d | |
release: | |
runs-on: ubuntu-latest | |
if: github.base_ref == 'main' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dawidd6/action-download-artifact@v2 | |
with: | |
pr: ${{github.event.pull_request.number}} | |
workflow: CI.yml | |
name: table | |
- uses: dawidd6/action-download-artifact@v2 | |
with: | |
pr: ${{github.event.pull_request.number}} | |
workflow: CI.yml | |
name: executable | |
- uses: dawidd6/action-download-artifact@v2 | |
with: | |
pr: ${{github.event.pull_request.number}} | |
workflow: CI.yml | |
name: apk | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
generate_release_notes: true | |
files: | | |
app-release.apk | |
table.csv | |
first_aid_bot | |
notify: | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: github.base_ref == 'main' | |
steps: | |
- uses: dawidd6/action-download-artifact@v2 | |
with: | |
pr: ${{github.event.pull_request.number}} | |
workflow: CI.yml | |
name: table | |
- name: send telegram message on push | |
uses: appleboy/telegram-action@master | |
if: always() && github.base_ref == 'main' && !contains(needs.*.result, 'failure') | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
document: table.csv | |
message: | | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
See changes: https://github.com/${{ github.repository }}/actions/runs/${{github.sha}} | |
See error: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
Successfully deployed! 🙆 | |
- name: send telegram message on push | |
uses: appleboy/telegram-action@master | |
if: always() && github.base_ref == 'main' && contains(needs.*.result, 'failure') | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
document: table.csv | |
message: | | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
See changes: https://github.com/${{ github.repository }}/actions/runs/${{github.sha}} | |
See error: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
The commit fails to build or tests have failed! 💣 |