Skip to content

Update Microsoft download app manifests #84

Update Microsoft download app manifests

Update Microsoft download app manifests #84

Workflow file for this run

name: Release
permissions:
contents: write
pull-requests: read
defaults:
run:
shell: bash
on:
pull_request:
types:
- closed
branches:
- main
paths:
- 'Apps/**'
- 'Manifests/**'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
name: 'Create release'
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Calculate SHA256 hashes and save to CSV'
run: |
echo "file_path,sha256" > sha256_hashes.csv
find Apps Manifests -type f | sort | while read -r file; do
hash=$(sha256sum "$file" | awk '{print $1}')
echo "$file,$hash" >> sha256_hashes.csv
done
- name: 'Set release tag (yy.MM.dd)'
id: set_tag
run: echo "TAG=$(date +'%y.%m.%d')" >> $GITHUB_OUTPUT
- name: 'Compress directories'
run: |
zip -r evergreen-apps.zip Apps Manifests sha256_hashes.csv
- name: 'Check ZIP file size'
run: |
if [ ! -s evergreen-apps.zip ]; then
echo "ZIP file is empty or missing."
exit 1
fi
- name: 'Verify ZIP file integrity'
run: |
if ! unzip -tq evergreen-apps.zip; then
echo "ZIP file is corrupt or missing files."
exit 1
fi
- name: 'Get changed files for this commit'
id: changed_files
run: |
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
# For pull requests, get changed files from the PR
gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files[].path' | grep -E '^(Apps/|Manifests/)' > changed_files.txt || true
if [ ! -s changed_files.txt ]; then
echo "No changed files detected." > changed_files.txt
fi
else
echo "No changed files detected." > changed_files.txt
fi
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Get PR information'
id: pr_info
run: |
# Find the PR that was merged into main for this commit
PR_NUMBER=$(gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number')
if [ -n "$PR_NUMBER" ]; then
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
# Get PR title and body
gh pr view $PR_NUMBER --json title,body --jq '.title' > pr_title.txt
gh pr view $PR_NUMBER --json title,body --jq '.body' > pr_body.txt
else
echo "No associated PR found" > pr_title.txt
echo "" > pr_body.txt
echo "PR_NUMBER=" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Create release notes'
id: release_notes
run: |
# Start with commit message
git log -1 --pretty=format:"%s" > release_notes.md
echo "" >> release_notes.md
echo "" >> release_notes.md
# Add PR information if available
if [ -n "${{ steps.pr_info.outputs.PR_NUMBER }}" ]; then
echo "### Pull Request #${{ steps.pr_info.outputs.PR_NUMBER }}" >> release_notes.md
echo "" >> release_notes.md
echo "**$(cat pr_title.txt)**" >> release_notes.md
echo "" >> release_notes.md
if [ -s pr_body.txt ] && [ "$(cat pr_body.txt)" != "null" ]; then
cat pr_body.txt >> release_notes.md
echo "" >> release_notes.md
fi
fi
# Add changed files
echo "### Files changed in this release:" >> release_notes.md
echo "" >> release_notes.md
cat changed_files.txt | sed 's/^/- /' >> release_notes.md
# Add the update-evergreen note
echo "### How to update" >> release_notes.md
echo "" >> release_notes.md
echo "Use [Update-Evergreen](https://eucpilots.com/evergreen/updateapps) to update to this release." >> release_notes.md
echo "" >> release_notes.md
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
cat release_notes.md >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: 'Create Git tag'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.set_tag.outputs.TAG }}.${{ github.run_number }}"
git push origin "v${{ steps.set_tag.outputs.TAG }}.${{ github.run_number }}"
- name: 'Create GitHub release'
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ steps.set_tag.outputs.TAG }}.${{ github.run_number }}"
name: "v${{ steps.set_tag.outputs.TAG }}.${{ github.run_number }}"
files: |
evergreen-apps.zip
sha256_hashes.csv
body_path: release_notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Verify release asset uploaded'
run: |
RELEASE_ID=$(gh release view "v${{ steps.set_tag.outputs.TAG }}.${{ github.run_number }}" --json id -q .id)
ASSET_COUNT=$(gh release view "v${{ steps.set_tag.outputs.TAG }}.${{ github.run_number }}" --json assets -q '.assets | length')
if [ "$ASSET_COUNT" -eq 0 ]; then
echo "No assets uploaded to the release."
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}