mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-29 16:14:59 +00:00
Add combined SHA256 GitHub Action
This commit is contained in:
19
.github/workflows/checksum.yml
vendored
19
.github/workflows/checksum.yml
vendored
@@ -1,5 +1,9 @@
|
||||
name: Generate & Attach SHA256 Checksum
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
releases: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
@@ -13,9 +17,22 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check Script Existence
|
||||
run: |
|
||||
if [ ! -f setup_harden_debian_ubuntu.sh ]; then
|
||||
echo "Error: setup_harden_debian_ubuntu.sh not found in repository root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Clean Existing Checksum
|
||||
if: github.event_name == 'release'
|
||||
run: |
|
||||
rm -f setup_harden_debian_ubuntu.sh.sha256
|
||||
|
||||
- name: Generate SHA256
|
||||
run: |
|
||||
sha256sum setup_harden_debian_ubuntu.sh > setup_harden_debian_ubuntu.sh.sha256
|
||||
echo "Generated checksum: $(cat setup_harden_debian_ubuntu.sh.sha256)"
|
||||
|
||||
- name: Commit SHA256 (only on push to main)
|
||||
if: github.event_name == 'push'
|
||||
@@ -29,7 +46,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload SHA256 to GitHub Release (only on release)
|
||||
if: github.event_name == 'release'
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: setup_harden_debian_ubuntu.sh.sha256
|
||||
|
||||
Reference in New Issue
Block a user