v3.0 Warframe Task Checklist - Release Notes #11
Workflow file for this run
This file contains hidden or 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: Create File-Friendly Release Source Archives | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build_source_archives: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref }} | |
| - name: Get Tag Name or Ref for Archives | |
| id: get_ref_name | |
| run: | | |
| if [ "${{ github.event_name }}" == "release" ]; then | |
| echo "REF_FOR_ARCHIVE=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
| else | |
| RAW_REF_NAME=$(echo "${{ github.ref }}" | sed -e 's|refs/heads/||' -e 's|refs/tags/||') | |
| SANITIZED_REF_NAME=$(echo "${RAW_REF_NAME}" | sed 's/[^a-zA-Z0-9._-]/-/g') | |
| echo "REF_FOR_ARCHIVE=${SANITIZED_REF_NAME:-manual-run}" >> $GITHUB_ENV | |
| fi | |
| env: | |
| REF_FOR_ARCHIVE: '' | |
| - name: Define Base Archive Name | |
| id: set_base_name | |
| run: | | |
| echo "ARCHIVE_BASE_NAME=Task-Checklist-${{ env.REF_FOR_ARCHIVE }}" >> $GITHUB_OUTPUT | |
| echo "Using archive base name: Task-Checklist-${{ env.REF_FOR_ARCHIVE }}" | |
| - name: Create a staging directory for source files | |
| run: mkdir ./source_package_staging | |
| - name: Copy source files to staging directory | |
| run: | | |
| cp -r ./sources/* ./source_package_staging/ | |
| if [ -f ./README.md ]; then cp ./README.md ./source_package_staging/; fi | |
| if [ -f ./LICENSE ]; then cp ./LICENSE ./source_package_staging/; fi | |
| ls -R ./source_package_staging | |
| - name: Inject Critical CSS into staged index.html | |
| working-directory: ./source_package_staging | |
| run: | | |
| CRITICAL_CSS_FILE="./css/critical.css" | |
| INDEX_HTML_FILE="./index.html" | |
| PLACEHOLDER="<%- criticalCss %>" | |
| if [ ! -f "$INDEX_HTML_FILE" ]; then | |
| echo "Error: $INDEX_HTML_FILE not found in staging directory." | |
| exit 1 | |
| fi | |
| if [ -f "$CRITICAL_CSS_FILE" ]; then | |
| CRITICAL_CSS_CONTENT=$(cat "$CRITICAL_CSS_FILE") | |
| STYLE_BLOCK_TEMP_FILE=$(mktemp) | |
| printf "<style type=\"text/css\">\n%s\n</style>" "${CRITICAL_CSS_CONTENT}" > "$STYLE_BLOCK_TEMP_FILE" | |
| INDEX_HTML_TEMP_FILE=$(mktemp) | |
| awk -v placeholder="$PLACEHOLDER" -v style_file="$STYLE_BLOCK_TEMP_FILE" ' | |
| BEGIN { | |
| while ((getline line < style_file) > 0) { | |
| style_block = style_block line "\n"; | |
| } | |
| close(style_file); | |
| sub(/\n$/, "", style_block); | |
| } | |
| { | |
| gsub(placeholder, style_block); | |
| print; | |
| } | |
| ' "$INDEX_HTML_FILE" > "$INDEX_HTML_TEMP_FILE" && mv "$INDEX_HTML_TEMP_FILE" "$INDEX_HTML_FILE" | |
| rm "$STYLE_BLOCK_TEMP_FILE" | |
| echo "Critical CSS injected." | |
| else | |
| echo "Warning: $CRITICAL_CSS_FILE not found. Placeholder '$PLACEHOLDER' in $INDEX_HTML_FILE will not be replaced." | |
| fi | |
| - name: Modify index.html for file:/// app.js compatibility (remove type=module) | |
| working-directory: ./source_package_staging | |
| run: | | |
| if [ -f ./index.html ]; then | |
| sed -i 's|<script type="module" src="js/app.js"|<script src="js/app.js"|g' ./index.html | |
| echo "app.js script tag modified in index.html." | |
| else | |
| echo "index.html not found in staging directory for JS modification." | |
| fi | |
| - name: Create Zip Archive (for Release Event Only) | |
| if: github.event_name == 'release' | |
| run: | | |
| cd ./source_package_staging | |
| zip -r ../${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.zip . | |
| cd .. | |
| echo "Zip archive for release created: ${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.zip" | |
| - name: Create Tar.gz Archive (for Release Event Only) | |
| if: github.event_name == 'release' | |
| run: | | |
| cd ./source_package_staging | |
| tar -czvf ../${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.tar.gz . | |
| cd .. | |
| echo "Tar.gz archive for release created: ${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.tar.gz" | |
| - name: Upload Source Directory as Artifact (for manual/dispatch runs) | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }} | |
| path: ./source_package_staging/ | |
| - name: Upload Zip Archive to Release with gh CLI | |
| if: github.event_name == 'release' && github.event.release.tag_name | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload "${{ github.event.release.tag_name }}" "./${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.zip" --clobber | |
| - name: Upload Tar.gz Archive to Release with gh CLI | |
| if: github.event_name == 'release' && github.event.release.tag_name | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload "${{ github.event.release.tag_name }}" "./${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.tar.gz" --clobber |