Skip to content

Commit

Permalink
Follow Security Guide to update release.yml (#36)
Browse files Browse the repository at this point in the history
* Update release.yml.

* Update upload-artifact and download-artifact.
  • Loading branch information
ActoryOu authored Nov 5, 2024
1 parent 5ccfcbc commit 222a79e
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,31 @@ jobs:
with:
ref: ${{ github.event.inputs.commit_id }}
- name: Configure git identity
env:
ACTOR: ${{ github.actor }}
run: |
git config --global user.name ${{ github.actor }}
git config --global user.email ${{ github.actor }}@users.noreply.github.com
git config --global user.name "$ACTOR"
git config --global user.email "$ACTOR"@users.noreply.github.com
- name: create a new branch that references commit id
run: git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }}
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
COMMIT_ID: ${{ github.event.inputs.commit_id }}
run: git checkout -b "$VERSION_NUMBER" "$COMMIT_ID"
- name: Tag Commit and Push to remote
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
git tag ${{ github.event.inputs.version_number }} -a -m "Release ${{ github.event.inputs.version_number }}"
git tag "$VERSION_NUMBER" -a -m "Release $VERSION_NUMBER"
git push origin --tags
- name: Verify tag on remote
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
COMMIT_ID: ${{ github.event.inputs.commit_id }}
run: |
git tag -d ${{ github.event.inputs.version_number }}
git tag -d "$VERSION_NUMBER"
git remote update
git checkout tags/${{ github.event.inputs.version_number }}
git diff ${{ github.event.inputs.commit_id }} tags/${{ github.event.inputs.version_number }}
git checkout tags/"$VERSION_NUMBER"
git diff "$COMMIT_ID" tags/"$VERSION_NUMBER"
create-zip:
needs: tag-commit
name: Create ZIP and verify package for release asset.
Expand All @@ -53,19 +63,23 @@ jobs:
cd FreeRTOS-LTS
git submodule update --init --checkout --recursive
- name: Create ZIP
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
zip -r FreeRTOSv${{ github.event.inputs.version_number }}.zip FreeRTOS-LTS -x "*.git*"
zip -r FreeRTOSv"$VERSION_NUMBER".zip FreeRTOS-LTS -x "*.git*"
ls ./
- name: Validate created ZIP
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
run: |
mkdir zip-check
mv FreeRTOSv${{ github.event.inputs.version_number }}.zip zip-check
mv FreeRTOSv"$VERSION_NUMBER".zip zip-check
cd zip-check
unzip FreeRTOSv${{ github.event.inputs.version_number }}.zip -d FreeRTOSv${{ github.event.inputs.version_number }}
ls FreeRTOSv${{ github.event.inputs.version_number }}
diff -r -x "*.git*" FreeRTOSv${{ github.event.inputs.version_number }}/FreeRTOS-LTS/ ../FreeRTOS-LTS/
unzip FreeRTOSv"$VERSION_NUMBER".zip -d FreeRTOSv"$VERSION_NUMBER"
ls FreeRTOSv"$VERSION_NUMBER"
diff -r -x "*.git*" FreeRTOSv"$VERSION_NUMBER"/FreeRTOS-LTS/ ../FreeRTOS-LTS/
- name: Create artifact of ZIP
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: FreeRTOSv${{ github.event.inputs.version_number }}.zip
path: zip-check/FreeRTOSv${{ github.event.inputs.version_number }}.zip
Expand All @@ -86,7 +100,7 @@ jobs:
draft: false
prerelease: false
- name: Download ZIP artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: FreeRTOSv${{ github.event.inputs.version_number }}.zip
- name: Upload Release Asset
Expand Down

0 comments on commit 222a79e

Please sign in to comment.