Release Dev Container Templates & Generate Documentation #31
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: "Release Dev Container Templates & Generate Documentation" | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Verify prebuild images | |
| shell: bash | |
| run: | | |
| for manifest_path in src/*/devcontainer-template.json; do | |
| template=$(basename "$(dirname "${manifest_path}")") | |
| runtime_option=$(jq -r '.options | keys[] | select(. != "azureFunctionsCliVersion")' "${manifest_path}") | |
| while IFS= read -r runtime_version; do | |
| image="ghcr.io/${GITHUB_REPOSITORY_OWNER}/devcontainers/${template}-base:${runtime_version}-noble" | |
| echo "Verifying ${image}" | |
| manifest=$(docker buildx imagetools inspect --raw "${image}") | |
| for architecture in amd64 arm64; do | |
| jq -e --arg architecture "${architecture}" ' | |
| any(.manifests[]; .platform.os == "linux" and .platform.architecture == $architecture) | |
| ' <<< "${manifest}" > /dev/null | |
| done | |
| done < <(jq -r ".options.${runtime_option}.proposals[]" "${manifest_path}") | |
| done | |
| - name: "Publish Templates" | |
| uses: devcontainers/action@1082abd5d2bf3a11abccba70eef98df068277772 # v1.4.3 | |
| with: | |
| publish-templates: "true" | |
| base-path-to-templates: "./src" | |
| generate-docs: "true" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create PR for Documentation | |
| id: push_image_info | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -e | |
| echo "Start." | |
| # Configure git and Push updates | |
| git config --global user.email github-actions[bot]@users.noreply.github.com | |
| git config --global user.name github-actions[bot] | |
| git config pull.rebase false | |
| # Replace 'blob/main' with 'blob/master' in generated README.md files | |
| find src -name 'README.md' -exec sed -i 's|blob/main|blob/master|g' {} + | |
| branch=automated-documentation-update-$GITHUB_RUN_ID | |
| git checkout -b $branch | |
| message='Automated documentation update' | |
| # Add / update and commit | |
| git add */**/README.md | |
| git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true | |
| # Push | |
| if [ "$NO_UPDATES" != "true" ] ; then | |
| git push origin "$branch" | |
| gh pr create --title "$message" --body "$message" | |
| fi |