Daily updates #178
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: Daily updates | |
on: | |
schedule: | |
- cron: '0 12 * * *' | |
workflow_dispatch: | |
env: | |
DOTNET_VERSION: '7.0.x' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
outputs: | |
exitcode: ${{ steps.run.outputs.exitcode }} | |
steps: | |
- name: Checkout MergeTool | |
uses: actions/checkout@v4 | |
with: | |
repository: guibranco/BancosBrasileiros-MergeTool | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Run | |
continue-on-error: true | |
id: run | |
run: | | |
set +e | |
cd BancosBrasileiros.MergeTool | |
dotnet run --configuration Release | |
exitcode="$?" | |
echo "exitcode=$exitcode" >> $GITHUB_ENV | |
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT | |
exit "$exitcode" | |
- name: Send webhook | |
if: env.exitcode != 0 && env.exitcode != 187 | |
uses: distributhor/workflow-webhook@v3 | |
env: | |
webhook_type: 'json-extended' | |
event_name: 'release' | |
webhook_url: ${{ secrets.WEBHOOK_URL }} | |
webhook_secret: '{"x-github-release-token": "${{ secrets.WEBHOOK_TOKEN }}"}' | |
data: '{ "error_code": "${{ env.exitcode }}" }' | |
- name: Upload banks files | |
uses: actions/upload-artifact@v3 | |
if: env.exitcode == 0 | |
with: | |
name: bankFiles | |
path: ./BancosBrasileiros.MergeTool/result/bancos.* | |
- name: Upload changelog file | |
uses: actions/upload-artifact@v3 | |
if: env.exitcode == 0 | |
with: | |
name: changeLogFile | |
path: ./BancosBrasileiros.MergeTool/result/CHANGELOG.md | |
- name: Upload release-notes.md | |
uses: actions/upload-artifact@v3 | |
if: env.exitcode == 0 | |
with: | |
name: releaseNotesFile | |
path: ./BancosBrasileiros.MergeTool/result/release-notes.md | |
update: | |
name: Update | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ needs.build.outputs.exitcode == 0 }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check artifact banks files | |
uses: xSAVIKx/artifact-exists-action@v0 | |
id: checkbanksfiles | |
with: | |
name: bankFiles | |
- name: Download banks files | |
uses: actions/download-artifact@v3 | |
if: steps.checkbanksfiles.outputs.exists == 'true' | |
with: | |
name: bankFiles | |
path: data/ | |
- name: Check artifact change log file | |
uses: xSAVIKx/artifact-exists-action@v0 | |
id: checkchangelogfile | |
with: | |
name: changeLogFile | |
- name: Download change log file | |
uses: actions/download-artifact@v3 | |
if: steps.checkchangelogfile.outputs.exists == 'true' | |
with: | |
name: changeLogFile | |
- name: Setup GIT config | |
if: steps.checkbanksfiles.outputs.exists == 'true' && steps.checkchangelogfile.outputs.exists == 'true' | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Commit and Push | |
if: steps.checkbanksfiles.outputs.exists == 'true' && steps.checkchangelogfile.outputs.exists == 'true' | |
run: | | |
git add . | |
git commit -m "Daily updates (bot)" | |
git push origin main |