Skip to content

Commit

Permalink
Create build-deploy-staging.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HassanAkbar committed Mar 13, 2024
1 parent f860dd0 commit 15ef15b
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/build-deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: site-deploy-github-pages

on:
push:
branches: "adding_build_deploy_staging_workflow"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
outputs:
environment-name: ${{ steps.prepare.outputs.environment-name }}
environment-url: ${{ steps.prepare.outputs.environment-url }}
steps:
- name: Setup prerequisites
run: |
sudo apt-get update
sudo apt-get install -y curl make libxml2-dev libxslt-dev openssl libcurl4-openssl-dev
- name: Prepare environment props
id: prepare
run: |
echo "environment-url=https://isotc211.geolexica.org/staging" >> $GITHUB_OUTPUT
echo "environment-name=staging" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: Checkout data
uses: actions/checkout@v3
with:
token: ${{ github.token }}
repository: geolexica/isotc211-glossary
path: isotc211-glossary
ref: refs/heads/main
fetch-depth: 1

- name: Checkout breviter
uses: actions/checkout@v3
with:
token: ${{ github.token }}
repository: geolexica/breviter
path: breviter
ref: main
fetch-depth: 1
submodules: true

- name: Cache relaton
uses: actions/cache@v3
with:
path: relaton
key: ${{ runner.os }}-${{ hashFiles(join(inputs.concepts-path, '/**/*.yaml')) }}

- name: Setup Pages
id: pages
uses: actions/configure-pages@v3

- name: Use Node
uses: actions/setup-node@v3
with:
node-version: '12'
cache: 'npm'

- run: npm install

- name: Build staging_site
run: make _staging_site

- name: Compress files
run: zip -9 -r staging_site.zip _staging_site

- uses: actions/upload-artifact@v3
if: steps.prepare.outputs.environment-name != 'skip'
with:
name: staging_site
path: staging_site.zip

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: _staging_site

deploy:
if: needs.build.outputs.environment-name != 'skip'
runs-on: ubuntu-latest
needs: build
environment:
name: ${{ needs.build.outputs.environment-name }}
url: ${{ needs.build.outputs.environment-url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit 15ef15b

Please sign in to comment.