Update pipeline.yml #14
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: build zip with latest commit hash | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: check out repository | |
uses: actions/checkout@v3 | |
- name: get latest commit hash | |
run: echo "LATEST_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: create commit hash file | |
run: echo $LATEST_COMMIT_HASH > latest_commit_hash.txt | |
- name : Archive Repository with Commit Hash | |
run: zip -r archive_with_hash.zip . -x "*.git*" -x "*.github*" | |
- name: Upload to zip-archive branch | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git checkout --orphan temp-branch | |
git rm -rf . | |
git add -f archive_with_hash.zip | |
git commit -m "Upload latest zip archive" | |
git branch -M zip-archive | |
git push -fu origin zip-archive |