-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8956f2
commit 8bb1687
Showing
14 changed files
with
639 additions
and
677 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build images for Docker container actions | ||
|
||
on: | ||
push: | ||
branches: [trunk] | ||
pull_request: | ||
branches: [trunk] | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build_actions: | ||
name: Build images for Docker container actions | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
action-dir: [gh-actions-docs] | ||
env: | ||
IMAGE_NAME: 'ghcr.io/3lvia/core-github-actions-templates/${{ matrix.action-dir }}:latest' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: 'ghcr.io' | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: '${{ matrix.action-dir }}' | ||
push: true | ||
tags: '${{ env.IMAGE_NAME }}' | ||
cache-from: 'type=registry,ref=${{ env.IMAGE_NAME }}' | ||
cache-to: 'type=inline' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,38 @@ name: Generate action documentation | |
on: | ||
push: | ||
branches: [trunk] | ||
pull_request: # TODO: remove | ||
branches: [trunk] | ||
|
||
jobs: | ||
generate_docs: | ||
name: Generate action documentation | ||
runs-on: ubuntu-latest | ||
env: | ||
ACTION_DIRS: 'build,deploy,trivy-iac-scan,terraform-format' | ||
outputs: | ||
readme: ${{ steps.set-output.outputs.readme }} | ||
container: | ||
image: ghcr.io/3lvia/core-github-actions-templates/gh-actions-docs:latest | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Generate action documentation | ||
run: gh-actions-docs | ||
env: | ||
IGNORE_FILES: 'my-new-action/action.yml' | ||
IGNORE-HEADERS: '# core-github-actions-templates,## Table of Contents' | ||
|
||
- name: Set output | ||
id: set-output | ||
run: echo "readme=$(cat README.md)" >> $GITHUB_OUTPUT | ||
|
||
commit_docs: | ||
name: Commit action documentation | ||
runs-on: ubuntu-latest | ||
needs: [generate_docs] | ||
permissions: | ||
contents: write | ||
steps: | ||
|
@@ -25,32 +50,24 @@ jobs: | |
uses: actions/cache@v4 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
key: "${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}" | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Generate action documentation | ||
run: | | ||
for ACTION_FILE in $(echo "$ACTION_DIRS" | tr ',' '\n'); do | ||
yarn gen-docs "$ACTION_FILE/action.yml" | ||
done | ||
- name: Generate table of contents using gh-md-toc | ||
run: | | ||
wget "https://raw.githubusercontent.com/ekalinin/github-markdown-toc/$GH_MD_TOC_VERSION/gh-md-toc" | ||
chmod +x gh-md-toc | ||
./gh-md-toc --insert --no-backup --skip-header README.md | ||
env: | ||
GH_MD_TOC_VERSION: 0.10.0 | ||
- name: Get README from output | ||
run: echo "${{ needs.generate_docs.outputs.readme }}" > README.md | ||
|
||
- name: Format README | ||
run: yarn prettier -w --single-quote README.md | ||
|
||
- name: Debug, remove this # TODO: remove | ||
run: cat README.md | ||
|
||
- name: Commit changes | ||
if: false # TODO: remove | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add README.md | ||
git commit -m "Update action documentation" | ||
git push | ||
git commit -m |
Oops, something went wrong.