Skip to content

Commit d2cd068

Browse files
committed
refactor: impove CI setup to use release action
1 parent 8583289 commit d2cd068

1 file changed

Lines changed: 25 additions & 52 deletions

File tree

.github/workflows/staging.yml

Lines changed: 25 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,36 @@ name: Knative Tutorial Staging
22

33
on:
44
push:
5-
branches:
6-
- staging
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
710
env:
811
SITE_DIR: 'gh-pages'
12+
STAGING_REPO: 'redhat-developer-docs/knative-tutorial-staging'
13+
STAGING_SITE_PLAYBOOK: 'staging.yml'
914
jobs:
10-
build_site:
11-
name: "Build site with Antora"
12-
runs-on: [ubuntu-latest]
15+
stagingSite:
16+
name: Build and Deploy Staging Site
17+
runs-on: ubuntu-latest
1318
steps:
1419
- name: Checkout
1520
uses: actions/checkout@v2
16-
- name: "Generate site using antora site action"
17-
uses: kameshsampath/antora-site-action@master
21+
- name: Generate Site
22+
uses: kameshsampath/antora-site-action@v0.2.4
1823
with:
19-
antora_playbook: staging.yaml
20-
# - name: "List folder"
21-
# run: |
22-
# ls -ltr $GITHUB_WORKSPACE/
23-
- name: "Upload generated site"
24-
uses: actions/upload-artifact@v1.0.0
24+
antora_playbook: "${{ env.STAGING_SITE_PLAYBOOK }}"
25+
- name: List Directory
26+
run: |
27+
ls -ltr "${{ github.workspace }}"
28+
ls -ltr "${{ env.SITE_DIR }}"
29+
- name: Deploy Site
30+
id: deploy_site
31+
uses: peaceiris/actions-gh-pages@v3
2532
with:
26-
name: site
27-
path: "${{ github.workspace }}/${{ env.SITE_DIR }}"
28-
deploy_site:
29-
runs-on: [ubuntu-latest]
30-
needs: [build_site]
31-
name: "Deploy to Staging"
32-
steps:
33-
- name: Checkout
34-
uses: actions/checkout@v2
35-
with:
36-
repository: redhat-developer-docs/knative-tutorial-staging
37-
path: knative-tutorial-staging
38-
- name: Install SSH Client
39-
uses: webfactory/ssh-agent@v0.2.0
40-
with:
41-
ssh-private-key: ${{ secrets.KNATIVE_TUTORIAL_STAGING }}
42-
- name: Download generated site
43-
uses: actions/download-artifact@v1
44-
with:
45-
name: site
46-
path: "${{ github.workspace }}/knative-tutorial-staging/${{ env.SITE_DIR }}"
47-
- name: Deploy to GitHub Pages
48-
working-directory: "${{ github.workspace }}/knative-tutorial-staging"
49-
run: |
50-
git config --global user.email "kamesh.sampath@hotmail.com"
51-
git config --global user.name "Kamesh Sampath"
52-
- name: Setup Node.js for use with actions
53-
uses: actions/setup-node@v1.1.0
54-
with:
55-
version: "12.x"
56-
- name: Deploy to GitHub Pages
57-
working-directory: "${{ github.workspace }}/knative-tutorial-staging"
58-
run: |
59-
npm -g install gh-pages@2.2.0
60-
touch $SITE_DIR/.nojekyll
61-
gh-pages --dist=$SITE_DIR \
62-
--repo="git@github.com:redhat-developer-docs/knative-tutorial-staging.git" \
63-
--dotfiles='true' \
64-
--message="Publish Staging Site, Build run: ${{github.run_number}} "
33+
deploy_key: "${{ secrets.TKN_STAGING_SITE_DEPLOY }}"
34+
publish_dir: "${{ env.SITE_DIR }}"
35+
publish_branch: "gh-pages"
36+
external_repository: redhat-developer-demos/tekton-tutorial-staging
37+
full_commit_message: ${{ github.event.head_commit.message }}

0 commit comments

Comments
 (0)