name: WebsiteDeploy # Run this workflow every time a new commit pushed to your repository on: push: branches: - main pull_request: branches: - main env: NODE_VERSION: '14' GO_VERSION: '^1.15.5' HUGO_VERSION: '0.79.0' CUSTOM_DOMAIN: true DOMAIN: 'ashishsaxena.net' jobs: # Set the job key. The key is displayed as the job name # when a job name is not provided website-deploy: # Name the Job name: Deploy to Github Pages # Set the type of machine to run on runs-on: ubuntu-latest steps: # Checks out a copy of your repository on the ubuntu-latest machine - uses: actions/checkout@v2 # Install NodeJS - uses: actions/setup-node@v1 with: node-version: ${{env.NODE_VERSION}} # Install Dependencies - run: npm install # Build CSS from SCSS - run: npm run css-build # Install Go - uses: actions/setup-go@v2 with: go-version: ${{env.GO_VERSION}} # Install Hugo - name: Install Hugo run: | wget -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v${{env.HUGO_VERSION}}/hugo_${{env.HUGO_VERSION}}_Linux-64bit.deb sudo dpkg -i hugo.deb rm -rf hugo.deb hugo -d website # Set Custom Domain Name - if: ${{env.CUSTOM_DOMAIN}} name: Set Custom Domain run: echo ${{env.DOMAIN}} > website/CNAME # Deploy to gh-pages branch - name: Deploy to Pages run: | git add website/ git config user.name github-actions git config user.email github-actions@github.com git commit -m "deploy" git subtree split --prefix website -b gh-pages git push -f origin gh-pages:gh-pages