-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Download and Unzip Artifact | ||
|
||
on: | ||
schedule: | ||
- cron: '30 8 * * *' | ||
push: | ||
|
||
jobs: | ||
download_and_unzip: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get Latest Artifact URL | ||
run: | | ||
latest_artifact_url=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
https://api.github.com/repos/Cats-Team/AdRules/actions/artifacts \ | ||
| jq -r '.artifacts | sort_by(.created_at) | last | .archive_download_url') | ||
echo $latest_artifact_url > artifact_url.txt | ||
- name: Download Latest Artifact | ||
run: | | ||
curl -L -o artifact.zip -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
$(cat artifact_url.txt) | ||
- name: Unzip Artifact | ||
run: unzip artifact.zip -d ./ | ||
|
||
- name: Commit and Push Changes | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add . | ||
git commit -m "Add latest artifact" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |