Skip to content

Commit b3908d4

Browse files
correct yaml
1 parent 4fc6c36 commit b3908d4

File tree

2 files changed

+230
-82
lines changed

2 files changed

+230
-82
lines changed
Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "2. Deploy docs to GitHub Pages"
1+
name: "3. CI/CD deploy"
22

33
on:
44
workflow_run:
@@ -65,84 +65,84 @@ jobs:
6565
echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
6666
echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
6767
# echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
68-
- name: "List variables"
69-
run: |
70-
export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
71-
export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
72-
export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
73-
export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
74-
export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
75-
export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
76-
export VERSION="${{ steps.variables.outputs.version }}"
77-
# export TAG="${{ steps.variables.outputs.tag }}"
78-
make list-variables
79-
80-
deploy-jekyll:
81-
environment:
82-
name: github-pages
83-
url: ${{ steps.deployment.outputs.page_url }}
84-
runs-on: ubuntu-latest
85-
needs: metadata
86-
steps:
87-
- name: "Checkout code"
88-
uses: actions/checkout@v5
89-
90-
- name: "Get version"
91-
id: get-asset-version
92-
shell: bash
93-
env:
94-
GH_TOKEN: ${{ github.token }}
95-
run: |
96-
INPUTS_INCLUDE_PRERELEASES="${{ inputs.include_prereleases }}"
97-
INPUTS_INCLUDE_PRERELEASES=${INPUTS_INCLUDE_PRERELEASES:-"true"}
98-
99-
INPUTS_VERSION="${{ inputs.version }}"
100-
INPUTS_VERSION=${INPUTS_VERSION:-"latest"}
101-
102-
103-
if [[ $INPUTS_INCLUDE_PRERELEASES == true ]]; then
104-
json=$(gh release list --json tagName --limit 1 --exclude-drafts)
105-
else
106-
json=$(gh release list --json tagName --limit 1 --exclude-drafts --exclude-pre-releases)
107-
fi
108-
109-
echo "Release list response: $json"
110-
111-
# Check if the response is empty
112-
if [[ "$json" == "[]" ]] || [[ -z "$json" ]]; then
113-
echo "::error::No releases found. Please create a release before deploying docs."
114-
exit 1
115-
fi
116-
117-
release_version=$(echo $json | jq -r '.[0].tagName')
118-
if [[ "$release_version" == "null" ]] || [[ -z "$release_version" ]]; then
119-
echo "::error::Could not extract release version from: $json"
120-
exit 1
121-
fi
122-
123-
echo "Found release version: $release_version"
124-
125-
if [[ $INPUTS_VERSION == latest ]]; then
126-
echo "release_version=$release_version" >> $GITHUB_OUTPUT
127-
else
128-
echo "release_version=$INPUTS_VERSION" >> $GITHUB_OUTPUT
129-
fi
130-
131-
- name: "Get release version"
132-
id: download-asset
133-
shell: bash
134-
env:
135-
GH_TOKEN: ${{ github.token }}
136-
run: |
137-
gh release download ${{steps.get-asset-version.outputs.release_version}} -p jekyll-docs-*.tar --output artifact.tar
138-
139-
- uses: actions/upload-artifact@v4
140-
with:
141-
name: jekyll-docs-${{steps.get-asset-version.outputs.release_version}}
142-
path: artifact.tar
143-
144-
- name: Deploy to GitHub Pages
145-
id: deployment
146-
uses: actions/deploy-pages@v4
147-
with:
148-
artifact_name: jekyll-docs-${{steps.get-asset-version.outputs.release_version}}
68+
# - name: "List variables"
69+
# run: |
70+
# export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
71+
# export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
72+
# export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
73+
# export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
74+
# export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
75+
# export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
76+
# export VERSION="${{ steps.variables.outputs.version }}"
77+
# # export TAG="${{ steps.variables.outputs.tag }}"
78+
# make list-variables
79+
80+
# deploy-jekyll:
81+
# environment:
82+
# name: github-pages
83+
# url: ${{ steps.deployment.outputs.page_url }}
84+
# runs-on: ubuntu-latest
85+
# needs: metadata
86+
# steps:
87+
# - name: "Checkout code"
88+
# uses: actions/checkout@v5
89+
90+
# - name: "Get version"
91+
# id: get-asset-version
92+
# shell: bash
93+
# env:
94+
# GH_TOKEN: ${{ github.token }}
95+
# run: |
96+
# INPUTS_INCLUDE_PRERELEASES="${{ inputs.include_prereleases }}"
97+
# INPUTS_INCLUDE_PRERELEASES=${INPUTS_INCLUDE_PRERELEASES:-"true"}
98+
99+
# INPUTS_VERSION="${{ inputs.version }}"
100+
# INPUTS_VERSION=${INPUTS_VERSION:-"latest"}
101+
102+
103+
# if [[ $INPUTS_INCLUDE_PRERELEASES == true ]]; then
104+
# json=$(gh release list --json tagName --limit 1 --exclude-drafts)
105+
# else
106+
# json=$(gh release list --json tagName --limit 1 --exclude-drafts --exclude-pre-releases)
107+
# fi
108+
109+
# echo "Release list response: $json"
110+
111+
# # Check if the response is empty
112+
# if [[ "$json" == "[]" ]] || [[ -z "$json" ]]; then
113+
# echo "::error::No releases found. Please create a release before deploying docs."
114+
# exit 1
115+
# fi
116+
117+
# release_version=$(echo $json | jq -r '.[0].tagName')
118+
# if [[ "$release_version" == "null" ]] || [[ -z "$release_version" ]]; then
119+
# echo "::error::Could not extract release version from: $json"
120+
# exit 1
121+
# fi
122+
123+
# echo "Found release version: $release_version"
124+
125+
# if [[ $INPUTS_VERSION == latest ]]; then
126+
# echo "release_version=$release_version" >> $GITHUB_OUTPUT
127+
# else
128+
# echo "release_version=$INPUTS_VERSION" >> $GITHUB_OUTPUT
129+
# fi
130+
131+
# - name: "Get release version"
132+
# id: download-asset
133+
# shell: bash
134+
# env:
135+
# GH_TOKEN: ${{ github.token }}
136+
# run: |
137+
# gh release download ${{steps.get-asset-version.outputs.release_version}} -p jekyll-docs-*.tar --output artifact.tar
138+
139+
# - uses: actions/upload-artifact@v4
140+
# with:
141+
# name: jekyll-docs-${{steps.get-asset-version.outputs.release_version}}
142+
# path: artifact.tar
143+
144+
# - name: Deploy to GitHub Pages
145+
# id: deployment
146+
# uses: actions/deploy-pages@v4
147+
# with:
148+
# artifact_name: jekyll-docs-${{steps.get-asset-version.outputs.release_version}}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: "2. Deploy docs to GitHub Pages"
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Docs 1. CI/CD"]
6+
types:
7+
- completed
8+
branches: [main]
9+
workflow_dispatch:
10+
inputs:
11+
include_prereleases:
12+
type: choice
13+
description: "Include pre-releases"
14+
default: "true"
15+
options:
16+
- "true"
17+
- "false"
18+
version:
19+
type: string
20+
default: latest
21+
description: "Install specific version"
22+
23+
run-name: >-
24+
${{ (inputs.include_prereleases != null
25+
&& inputs.version != null
26+
&& format('Triggered Manually. Include prerelease: {0} Version: {1} By: @{2}',
27+
inputs.include_prereleases,
28+
inputs.version,
29+
github.actor))
30+
|| format('Triggered by {0} ({1}). Include prerelease: true Version: latest',
31+
github.event.workflow_run.name,
32+
github.event.workflow_run.display_title) }}
33+
34+
permissions:
35+
contents: read
36+
pages: write
37+
id-token: write
38+
39+
jobs:
40+
metadata:
41+
name: "Set CI/CD metadata"
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 1
44+
outputs:
45+
build_datetime: ${{ steps.variables.outputs.build_datetime }}
46+
build_timestamp: ${{ steps.variables.outputs.build_timestamp }}
47+
build_epoch: ${{ steps.variables.outputs.build_epoch }}
48+
nodejs_version: ${{ steps.variables.outputs.nodejs_version }}
49+
python_version: ${{ steps.variables.outputs.python_version }}
50+
terraform_version: ${{ steps.variables.outputs.terraform_version }}
51+
version: ${{ steps.variables.outputs.version }}
52+
# tag: ${{ steps.variables.outputs.tag }}
53+
steps:
54+
- name: "Checkout code"
55+
uses: actions/checkout@v5
56+
- name: "Set CI/CD variables"
57+
id: variables
58+
run: |
59+
datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
60+
echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
61+
echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
62+
echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
63+
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
64+
echo "python_version=$(grep "^python\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
65+
echo "terraform_version=$(grep "^terraform\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
66+
echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
67+
# echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
68+
- name: "List variables"
69+
run: |
70+
export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
71+
export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}"
72+
export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}"
73+
export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
74+
export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
75+
export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
76+
export VERSION="${{ steps.variables.outputs.version }}"
77+
# export TAG="${{ steps.variables.outputs.tag }}"
78+
make list-variables
79+
80+
deploy-jekyll:
81+
environment:
82+
name: github-pages
83+
url: ${{ steps.deployment.outputs.page_url }}
84+
runs-on: ubuntu-latest
85+
needs: metadata
86+
steps:
87+
- name: "Checkout code"
88+
uses: actions/checkout@v5
89+
90+
- name: "Get version"
91+
id: get-asset-version
92+
shell: bash
93+
env:
94+
GH_TOKEN: ${{ github.token }}
95+
run: |
96+
INPUTS_INCLUDE_PRERELEASES="${{ inputs.include_prereleases }}"
97+
INPUTS_INCLUDE_PRERELEASES=${INPUTS_INCLUDE_PRERELEASES:-"true"}
98+
99+
INPUTS_VERSION="${{ inputs.version }}"
100+
INPUTS_VERSION=${INPUTS_VERSION:-"latest"}
101+
102+
103+
if [[ $INPUTS_INCLUDE_PRERELEASES == true ]]; then
104+
json=$(gh release list --json tagName --limit 1 --exclude-drafts)
105+
else
106+
json=$(gh release list --json tagName --limit 1 --exclude-drafts --exclude-pre-releases)
107+
fi
108+
109+
echo "Release list response: $json"
110+
111+
# Check if the response is empty
112+
if [[ "$json" == "[]" ]] || [[ -z "$json" ]]; then
113+
echo "::error::No releases found. Please create a release before deploying docs."
114+
exit 1
115+
fi
116+
117+
release_version=$(echo $json | jq -r '.[0].tagName')
118+
if [[ "$release_version" == "null" ]] || [[ -z "$release_version" ]]; then
119+
echo "::error::Could not extract release version from: $json"
120+
exit 1
121+
fi
122+
123+
echo "Found release version: $release_version"
124+
125+
if [[ $INPUTS_VERSION == latest ]]; then
126+
echo "release_version=$release_version" >> $GITHUB_OUTPUT
127+
else
128+
echo "release_version=$INPUTS_VERSION" >> $GITHUB_OUTPUT
129+
fi
130+
131+
- name: "Get release version"
132+
id: download-asset
133+
shell: bash
134+
env:
135+
GH_TOKEN: ${{ github.token }}
136+
run: |
137+
gh release download ${{steps.get-asset-version.outputs.release_version}} -p jekyll-docs-*.tar --output artifact.tar
138+
139+
- uses: actions/upload-artifact@v4
140+
with:
141+
name: jekyll-docs-${{steps.get-asset-version.outputs.release_version}}
142+
path: artifact.tar
143+
144+
- name: Deploy to GitHub Pages
145+
id: deployment
146+
uses: actions/deploy-pages@v4
147+
with:
148+
artifact_name: jekyll-docs-${{steps.get-asset-version.outputs.release_version}}

0 commit comments

Comments
 (0)