|
| 1 | +name: Deploy LiaScript-Web-Site to Pages |
| 2 | + |
| 3 | +on: |
| 4 | + # Runs on pushes targeting the default branch |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + |
| 18 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 19 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 20 | +concurrency: |
| 21 | + group: "pages" |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +# Default to bash |
| 25 | +defaults: |
| 26 | + run: |
| 27 | + shell: bash |
| 28 | + |
| 29 | +jobs: |
| 30 | + # Build job |
| 31 | + hugo: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + env: |
| 34 | + HUGO_VERSION: 0.132.2 |
| 35 | + steps: |
| 36 | + - name: Install Hugo CLI |
| 37 | + run: | |
| 38 | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ |
| 39 | + && sudo dpkg -i ${{ runner.temp }}/hugo.deb |
| 40 | + - name: Install Dart Sass |
| 41 | + run: sudo snap install dart-sass |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + submodules: recursive |
| 46 | + - name: Setup Pages |
| 47 | + id: pages |
| 48 | + uses: actions/configure-pages@v5 |
| 49 | + - name: Install Node.js dependencies |
| 50 | + run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" |
| 51 | + - name: Install PostCSS, Tailwind and Autoprefixer |
| 52 | + run: npm install postcss postcss-cli tailwindcss autoprefixer |
| 53 | + - name: Install Python |
| 54 | + run: sudo apt-get install python3 |
| 55 | + - name: Build World-Map |
| 56 | + run: "cd world-map && python3 generate.py" |
| 57 | + - name: Build with Hugo |
| 58 | + env: |
| 59 | + HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache |
| 60 | + HUGO_ENVIRONMENT: production |
| 61 | + run: "npm run build" |
| 62 | + |
| 63 | + - name: List contents of public directory |
| 64 | + run: ls -la $(pwd)/public |
| 65 | + |
| 66 | + - name: Upload artifact |
| 67 | + uses: actions/upload-pages-artifact@v3 |
| 68 | + with: |
| 69 | + name: public |
| 70 | + path: ./public |
| 71 | + |
| 72 | + liascript: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - name: Set ELM_HOME |
| 76 | + run: echo "ELM_HOME=${GITHUB_WORKSPACE}/.elm" >> $GITHUB_ENV |
| 77 | + |
| 78 | + # build LiaScript |
| 79 | + - name: LiaScript - download |
| 80 | + run: git clone --branch development https://github.com/LiaScript/LiaScript.git |
| 81 | + - name: LiaScript - prebuild |
| 82 | + run: | |
| 83 | + cd LiaScript |
| 84 | + npm install |
| 85 | + npm run prebuild |
| 86 | + - name: LiaScript - patches |
| 87 | + run: | |
| 88 | + cd LiaScript |
| 89 | + git submodule update --init --recursive |
| 90 | + cd patches |
| 91 | + make |
| 92 | + cd .. |
| 93 | + rm -rf elm-stuff .parcel-cache |
| 94 | + - name: LiaScript - build |
| 95 | + run: | |
| 96 | + cd LiaScript |
| 97 | + make all2 KEY="${{ secrets.RESPONSIVEVOICE_KEY }}" |
| 98 | +
|
| 99 | + - name: Upload artifact |
| 100 | + uses: actions/upload-pages-artifact@v3 |
| 101 | + with: |
| 102 | + name: course |
| 103 | + path: ./LiaScript/dist |
| 104 | + |
| 105 | + liascript-nightly: |
| 106 | + runs-on: ubuntu-latest |
| 107 | + steps: |
| 108 | + - name: Set ELM_HOME |
| 109 | + run: echo "ELM_HOME=${GITHUB_WORKSPACE}/.elm" >> $GITHUB_ENV |
| 110 | + |
| 111 | + # build LiaScript |
| 112 | + - name: LiaScript - download |
| 113 | + run: git clone --branch feat/minimizeNavigation https://github.com/LiaScript/LiaScript.git |
| 114 | + - name: LiaScript - prebuild |
| 115 | + run: | |
| 116 | + cd LiaScript |
| 117 | + npm install |
| 118 | + npm run prebuild |
| 119 | + - name: LiaScript - patches |
| 120 | + run: | |
| 121 | + cd LiaScript |
| 122 | + git submodule update --init --recursive |
| 123 | + cd patches |
| 124 | + make |
| 125 | + cd .. |
| 126 | + rm -rf elm-stuff .parcel-cache |
| 127 | + - name: LiaScript - build |
| 128 | + run: | |
| 129 | + cd LiaScript |
| 130 | + make all2 KEY="${{ secrets.RESPONSIVEVOICE_KEY }}" |
| 131 | + rm dist/sw.js |
| 132 | +
|
| 133 | + - name: Upload artifact |
| 134 | + uses: actions/upload-pages-artifact@v3 |
| 135 | + with: |
| 136 | + name: nightly |
| 137 | + path: ./LiaScript/dist |
| 138 | + |
| 139 | + # Deployment job |
| 140 | + deploy: |
| 141 | + environment: |
| 142 | + name: github-pages |
| 143 | + url: ${{ steps.deployment.outputs.page_url }} |
| 144 | + runs-on: ubuntu-latest |
| 145 | + needs: |
| 146 | + - hugo |
| 147 | + - liascript |
| 148 | + - liascript-nightly |
| 149 | + steps: |
| 150 | + - name: Checkout repository |
| 151 | + uses: actions/checkout@v2 |
| 152 | + |
| 153 | + - name: Checkout gh-pages branch |
| 154 | + run: | |
| 155 | + git fetch origin gh-pages |
| 156 | + git checkout gh-pages || git checkout --orphan gh-pages |
| 157 | +
|
| 158 | + - name: Download Website |
| 159 | + uses: actions/download-artifact@master |
| 160 | + with: |
| 161 | + name: public |
| 162 | + path: public |
| 163 | + |
| 164 | + - name: Extract Website Artifact |
| 165 | + run: | |
| 166 | + mkdir -p public |
| 167 | + tar -xvf public/artifact.tar -C public |
| 168 | + rm public/artifact.tar |
| 169 | +
|
| 170 | + - name: Download LiaScript |
| 171 | + uses: actions/download-artifact@master |
| 172 | + with: |
| 173 | + name: course |
| 174 | + path: public/course |
| 175 | + |
| 176 | + - name: Extract LiaScript Artifact |
| 177 | + run: | |
| 178 | + mkdir -p public/course |
| 179 | + tar -xvf public/course/artifact.tar -C public/course |
| 180 | + rm public/course/artifact.tar |
| 181 | +
|
| 182 | + - name: Download LiaScript Nightly |
| 183 | + uses: actions/download-artifact@master |
| 184 | + with: |
| 185 | + name: nightly |
| 186 | + path: public/nightly |
| 187 | + |
| 188 | + - name: Extract LiaScript-Nightly Artifact |
| 189 | + run: | |
| 190 | + mkdir -p public/nightly |
| 191 | + tar -xvf public/nightly/artifact.tar -C public/nightly |
| 192 | + rm public/nightly/artifact.tar |
| 193 | +
|
| 194 | + - name: Deploy to GitHub Pages |
| 195 | + uses: peaceiris/actions-gh-pages@v3 |
| 196 | + with: |
| 197 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 198 | + publish_dir: ./public |
| 199 | + destination_dir: docs |
| 200 | + publish_branch: gh-pages |
0 commit comments