name: Deployment example

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

concurrency:
  group: "pages"
  cancel-in-progress: true

permissions:
  contents: read
  pages: write
  deployments: write
  id-token: write

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    
    - name: Download Rumage
      run: |
        wget https://github.com/notangelmario/rumage/releases/latest/download/rumage-x86_64-unknown-linux-gnu.tar.gz
        tar -xf rumage-x86_64-unknown-linux-gnu.tar.gz
        
    - name: Install Rumage
      run: |
        sudo install ./rumage /usr/bin
    
    - name: Install Rumage
      run: cargo install rumage

    - name: Build
      run: rumage build -s example -b build -r /rumage
    
    - name: Upload artifact
      uses: actions/upload-pages-artifact@v1
      with:
        path: './build'
          
  deploy:
    needs: build
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v1
