Add new tutorial #27
Workflow file for this run
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
name: build and release container | |
on: | |
push: | |
# branches: | |
# - development | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
compile: | |
name: compile web | |
runs-on: ubuntu-20.04 | |
container: | |
image: ghcr.io/metaheed/kolle-ci:v0.0.2 | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
strategy: | |
matrix: | |
java: [ '11' ] | |
steps: | |
- name: Check out main repo | |
uses: actions/checkout@v2 | |
- name: Checkout impl repo | |
uses: actions/checkout@v2 | |
with: | |
repository: metaheed/metarx.io | |
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT. need to generate this key from github personal setting | |
path: kolle | |
- name: Maven cache | |
id: maven-cache | |
uses: actions/cache@v2 | |
with: | |
path: /root/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/shadow-cljs.edn', '.github/workflows/**') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: npm cache | |
uses: actions/cache@v2 | |
with: | |
path: /root/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('webapp/shadow-cljs.edn') }}-${{ hashFiles('**/deps.cljs') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: npx package Module cache | |
id: npx-module-cache | |
uses: actions/cache@v2 | |
with: | |
path: kolle/webapp/node_modules | |
key: ${{ runner.os }}-maven-${{ hashFiles('kolle/webapp/package.json', '.github/workflows/**') }} | |
restore-keys: | | |
${{ runner.os }}-module- | |
- name: shadow-cljs compiler cache | |
uses: actions/cache@v2 | |
with: | |
path: kolle/webapp/.shadow-cljs | |
key: ${{ runner.os }}-shadow-cljs-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-shadow-cljs- | |
- if: steps.npx-module-cache.outputs.cache-hit != 'true' | |
working-directory: kolle/webapp | |
run: | | |
npm i --force | |
- name: shadow-cljs build prod | |
working-directory: kolle/webapp | |
run: | | |
npm i --force | |
npx shadow-cljs release prod | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: kollejs | |
path: kolle/resources/public/js/main.js | |
package: | |
name: Build docker and release package | |
needs: compile | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ '11' ] | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Checkout impl repo | |
uses: actions/checkout@v2 | |
with: | |
repository: metaheed/metarx.io | |
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT. need to generate this key from github personal setting | |
path: kolle | |
- name: Down load artificat | |
uses: actions/download-artifact@v3 | |
with: | |
name: kollejs | |
- name: Copy file | |
run: | | |
mkdir -p kolle/resources/public/js/ | |
cp main.js kolle/resources/public/js/ | |
- name: Maven cache | |
id: maven-cache | |
uses: actions/cache@v2 | |
with: | |
path: /root/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/deps.edn') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Setup Java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Setup Clojure | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
tools-deps: '1.10.3.1029' | |
- name: Build clj artifact | |
working-directory: kolle | |
run: | | |
clojure -T:build package | |
- name: Get the tag version | |
id: get_version | |
shell: bash | |
run: echo "##[set-output name=VERSION;]$(echo ${GITHUB_REF#refs/tags/})" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Publish to Registry | |
uses: elgohr/Publish-Docker-Github-Action@v5 | |
with: | |
name: metaheed/kolle | |
workdir: kolle/build/container | |
tags: "latest,${{ steps.get_version.outputs.VERSION }}" | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_PAT }} | |
platforms: linux/amd64,linux/arm64 | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.get_version.outputs.VERSION }} | |
release_name: Release ${{ steps.get_version.outputs.VERSION }} | |
body: | | |
[Changelog](https://github.com/metaheed/kolle.io) | |
draft: false | |
prerelease: false |