Update of the Resources #1448
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
# Automated Resource Update Workflow | |
name: Update of the Resources | |
# Define when the workflow should run. | |
on: | |
# Scheduled to run daily. | |
schedule: | |
- cron: "0 0 * * *" | |
# Triggered when changes are pushed to specified paths. | |
push: | |
paths: | |
- "assets/**" | |
# Triggered manually by workflow_dispatch event. | |
workflow_dispatch: | |
# Define the jobs to be executed. | |
jobs: | |
# Job for updating and managing resources. | |
update_resources: | |
name: Update and Manage Resources | |
runs-on: ubuntu-latest | |
steps: | |
# Check out code from the repository. | |
- name: Check out code | |
uses: actions/checkout@v4 | |
# Set up the Go version specified in go.mod. | |
- name: Set up Go version | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
check-latest: true | |
id: go | |
# Get Go dependencies. | |
- name: Get dependencies | |
run: go mod download | |
# Build the Go application. | |
- name: Build Application | |
run: go build . | |
# Generate new resources using content-blocker. | |
- name: Generate New Resources | |
run: ./content-blocker -update -logs | |
# Commit and push updates to the repository. | |
- name: Commit and Push Updates | |
run: | | |
git config user.name "github-actions" # Configure GitHub Actions bot as the commit author. | |
git config user.email "[email protected]" # Configure GitHub Actions bot as the commit author. | |
git add . # Add changes to the staging area. | |
git commit -m "Automated update: $(date)" # Commit changes with a timestamp. | |
git pull --rebase origin main # Rebase with remote main to avoid conflicts. | |
git push origin main # Push the commit to the main branch. |