-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (49 loc) · 1.84 KB
/
auto-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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.