Skip to content

Merge pull request #9 from andrewjswan/dependabot/npm_and_yarn/moment… #26

Merge pull request #9 from andrewjswan/dependabot/npm_and_yarn/moment…

Merge pull request #9 from andrewjswan/dependabot/npm_and_yarn/moment… #26

Workflow file for this run

name: Build / DTEK Blackout Schedule Calendars
on:
# Runs on pushes targeting the default branch
push:
# On Push to Master branch
branches:
- master
# Ignore all Tags / Release
tags-ignore:
- '**'
paths:
- '**.json'
- '**.mjs'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Calendars / Build
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: 18
- name: NPM Init
run: npm i
- name: Building
run: node index.mjs
- name: Upload Artifacts / Calendars
uses: actions/upload-artifact@v4
with:
name: iCal Calendars
path: |
${{ github.workspace }}/public/*/*.ical
if-no-files-found: error
calendars-listing:
runs-on: ubuntu-latest
name: Calendars Listings Index
needs:
- build
steps:
- name: Download Artifacts / Calendars
uses: actions/download-artifact@v4
with:
name: iCal Calendars
path: ${{ github.workspace }}/public/
- name: Generate Calendars Listings
uses: jayanta525/[email protected]
with:
FOLDER: public
- name: Upload Artifacts / Calendars Listings
uses: actions/upload-artifact@v4
with:
name: iCal Calendars Listings
path: |
${{ github.workspace }}/public/
if-no-files-found: error
cleanup:
name: Calendars / Delete deployment
runs-on: ubuntu-latest
permissions: write-all
needs:
- build
steps:
- name: Delete deployment
uses: strumwolf/delete-deployment-environment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: blackout-schedule-calendars
onlyRemoveDeployments: true
deploy:
name: Calendars / Deploy
needs:
- cleanup
- calendars-listing
environment:
name: blackout-schedule-calendars
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
# 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: true
steps:
- name: Download Artifacts / Calendars Listings
uses: actions/download-artifact@v4
with:
name: iCal Calendars Listings
path: ${{ github.workspace }}/public/
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ github.workspace }}/public/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Delete Artifacts / Calendars Listings
uses: geekyeggo/delete-artifact@v5
with:
name: iCal Calendars Listings
failOnError: false
- name: Delete Artifacts / Github Pages
uses: geekyeggo/delete-artifact@v5
with:
name: github-pages
failOnError: false
release:
name: Calendars / Release
runs-on: ubuntu-latest
needs:
- deploy
permissions:
contents: write
steps:
- name: Get Release Version
run: |
echo "version=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
id: version
- name: Get Release Tag
run: |
echo "tag=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
id: tag
- name: Release
uses: softprops/action-gh-release@v2
with:
name: Blackout Schedule Calendars - ${{steps.version.outputs.version}}
tag_name: v${{steps.tag.outputs.tag}}
generate_release_notes: true