-
Notifications
You must be signed in to change notification settings - Fork 3
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
d89e5a9
commit 673d876
Showing
1 changed file
with
66 additions
and
17 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 |
---|---|---|
@@ -1,33 +1,82 @@ | ||
name: CI | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
branches: | ||
- main | ||
|
||
# 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: "pages" | ||
cancel-in-progress: false | ||
|
||
# Default to bash | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: alpine | ||
env: | ||
HUGO_VERSION: 0.128.0 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install python and hugo | ||
run: apk add python3 hugo npm | ||
- name: Install Hugo CLI | ||
run: | | ||
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | ||
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v5 | ||
- name: generates content | ||
run: python3 generate.py | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
cache-dependency-path: site/package-lock.json | ||
- name: install npm modules | ||
run: npm --prefix ./site install | ||
- name: generate site | ||
run: hugo -s site | ||
- name: Pushes to another repository | ||
id: push_directory | ||
uses: cpina/github-action-push-to-another-repository@main | ||
- name: Build with Hugo | ||
env: | ||
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | ||
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache | ||
HUGO_ENVIRONMENT: production | ||
TZ: Asia/Kolkata | ||
run: | | ||
hugo \ | ||
--gc \ | ||
--minify \ | ||
--baseURL "${{ steps.pages.outputs.base_url }}/" | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
source-directory: 'site/public' | ||
destination-github-username: 'opendatakerala' | ||
destination-repository-name: 'map.opendatakerala.org' | ||
user-email: [email protected] | ||
user-name: OpenDataKerala | ||
commit-message: Automatic commit based on ORIGIN_COMMIT | ||
target-branch: gh-pages | ||
path: ./public | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |