Skip to content

Commit 0831b8b

Browse files
ci: update static ubuntu version to latest
* Instead of using the deprecated ubuntu 20.04 version in CI use -latest tag. * update publish preview action Signed-off-by: Jasper Berton <jasper.berton@team.blue>
1 parent 3249141 commit 0831b8b

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

.github/workflows/preview.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
check:
1111
name: "Content check"
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-latest
1313
steps:
1414
- name: "Checkout repo"
1515
uses: actions/checkout@v4
@@ -49,7 +49,7 @@ jobs:
4949
fi
5050
build:
5151
name: "Build preview"
52-
runs-on: ubuntu-20.04
52+
runs-on: ubuntu-latest
5353
outputs:
5454
PR_ID: ${{steps.details.outputs.PR_ID}}
5555
PREVIEW_PATH: ${{steps.details.outputs.PREVIEW_PATH}}
@@ -119,15 +119,21 @@ jobs:
119119
- name: "Run htmlproofer"
120120
run: docker run --rm --mount type=bind,source=$(pwd),target=/srv/site --entrypoint "/bin/bash" ovirt-site -c "bundle exec ruby htmlproofer_test.rb"
121121
publish:
122+
permissions:
123+
contents: write
122124
name: "Publish preview"
123-
runs-on: ubuntu-20.04
125+
runs-on: ubuntu-latest
124126
needs:
125127
- check
126128
- build
127129
concurrency:
128130
group: ovirt-site-preview-build
129131
cancel-in-progress: false
130132
steps:
133+
- name: set git defaults
134+
run: |
135+
git config --global user.name 'github-actions[bot]'
136+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
131137
- name: "Checkout repo"
132138
uses: actions/checkout@v4
133139
with:
@@ -144,22 +150,19 @@ jobs:
144150
path: "${{needs.build.outputs.PREVIEW_PATH}}"
145151
- name: "Commit changes"
146152
run: |
147-
set -euo pipefail
148-
git config --global user.name 'github-actions[bot]'
149-
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
150-
git add .
151-
if ! git diff-index --quiet HEAD --; then
152-
git commit -m "Adding or updating preview build for PR ${{needs.build.outputs.PR_ID}}"
153-
git push --set-upstream origin gh-pages
154-
else
155-
echo -e "No changes found."
153+
commit=$(git log --format="%H" -n 1)
154+
description=$(git describe --always)
155+
if git status --porcelain 2>/dev/null| grep -E "^??|^M"
156+
then
157+
git add .
158+
git commit -m "gh-pages ${description} ${commit}"
159+
git push
156160
fi
157161
env:
158162
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
159163
- name: "Send comment to PR"
160164
continue-on-error: true
161165
run: |
162-
set -euo pipefail
163166
echo "Your preview build is ready! ✨ Check the following link in 1-2 minutes: ${{needs.build.outputs.PREVIEW_LINK}} ." >/tmp/comment
164167
gh pr comment ${{needs.build.outputs.PR_ID}} -F /tmp/comment
165168
env:

.github/workflows/remove-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
remove:
1212
name: "Remove preview build"
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1414
concurrency:
1515
group: ovirt-site-preview-build
1616
cancel-in-progress: false

0 commit comments

Comments
 (0)