Bump actions/upload-artifact from 4.6.0 to 4.6.1 #177
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: update areas | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ ] | |
schedule: | |
- cron: "5 7 * * 1" # every third day at 7:05am UTC | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
repository_dispatch: # run workflow on api request | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: clone remote repo | |
run: git clone -b eugenoptic44-file-downloader https://codeberg.org/eUgEntOptIc44/Area-Generator/ AreaGenerator | |
- name: clone this repo | |
run: git clone https://github.com/${{ github.repository }}.git twfg-areas | |
- name: update packages | |
run: timeout 120s sudo apt update | |
# - name: upgrade packages | |
# run: timeout 120s sudo apt upgrade | |
- name: setup openjdk-11-jdk | |
run: sudo apt install openjdk-11-jdk -y | |
- name: setup wget | |
run: sudo apt install wget -y | |
- name: list directory contents | |
run: ls -lisha | |
- name: run Main.java | |
run: | | |
cd AreaGenerator | |
java -cp "gson-2.9.1.jar" Main.java | |
- name: copy areas.txt to github repo directory | |
run: cp AreaGenerator/areas.txt twfg-areas/areas.txt | |
- name: list directory contents | |
run: ls -lisha | |
- name: return directory size | |
run: du -sh | |
- name: write lastmod.txt file | |
run: echo $(date +%Y-%m-%d_%H:%M) > twfg-areas/lastmod.txt | |
- name: upload artifact areas.txt | |
uses: actions/upload-artifact@v4.6.1 | |
with: | |
name: areas.txt | |
path: | | |
twfg-areas/areas.txt | |
- name: download existing areas.txt and compare with generated one | |
id: downloadcompare | |
run: | | |
cd twfg-areas | |
wget https://codeberg.org/Starfish/TinyWeatherForecastGermany/raw/branch/master/app/src/main/res/raw/areas.txt || true | |
ls -lisha || true | |
diff -q areas.txt areas.txt.1 || true | |
OUTPUT=$(diff -q areas.txt areas.txt.1) || true | |
echo "diffstatus=$OUTPUT" >> $GITHUB_OUTPUT || true # send output to next actions step -> also see: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter | |
- name: git push to origin | |
if: steps.downloadcompare.outputs.diffstatus != 0 | |
run: | | |
cd twfg-areas | |
git config --local user.name twfgcicdbot | |
git config --local user.email twfgcicdbot@outlook.com | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git fetch --all | |
git checkout main | |
git reset | |
git add lastmod.txt | |
git add areas.txt | |
git status | |
git commit -m "update areas.txt" || true | |
git push -f origin main || true |