align 2023.02.01-georchestra #19
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: "mapstore" | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: "checking out" | |
uses: actions/checkout@v2 | |
with: | |
# 0 gets tags, needed for debian package | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: "setting up Java" | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11' | |
server-id: geOrchestra-artifactory | |
server-username: ARTIFACTORY_USERNAME_REF | |
server-password: ARTIFACTORY_TOKEN_REF | |
- name: "setting up npm" | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: "cache node modules" | |
uses: actions/cache@v1 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: "Maven repository caching" | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2/repository | |
key: mapstore-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
mapstore-${{ runner.os }}-maven- | |
- name: "install dependencies" | |
run: npm install | |
- name: "build" | |
run: npm run compile | |
- name: "run lint" | |
run: npm run lint | |
- name: "package with Maven" | |
run: mvn -B clean install -Dmapstore2.version=${{ github.sha }} | |
- name: "debian package with Maven" | |
run: mvn -B package deb:package -pl web -PdebianPackage | |
- name: "copy resulting deb" | |
run: mkdir -p scratch && cp web/target/georchestra-mapstore*.deb scratch/georchestra-mapstore-${{ github.sha }}.deb | |
- name: "publish deb as artifact" | |
uses: actions/upload-artifact@v1 | |
with: | |
name: georchestra-mapstore.deb | |
path: scratch/georchestra-mapstore-${{ github.sha }}.deb | |
- name: "copy resulting war" | |
run: mkdir -p scratch && cp web/target/mapstore.war scratch/mapstore-${{ github.sha }}.war | |
- name: "publish war as artifact" | |
uses: actions/upload-artifact@v1 | |
with: | |
name: mapstore.war | |
path: scratch/mapstore-${{ github.sha }}.war | |
- name: Getting image tag | |
if: github.repository == 'geo2france/mapstore2-georchestra' | |
id: version | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
- name: "Building docker image" | |
if: github.repository == 'geo2france/mapstore2-georchestra' | |
run: | | |
cp scratch/mapstore-${{ github.sha }}.war docker/MapStore-${{ steps.version.outputs.VERSION }}.war | |
docker build . -t ghcr.io/geo2france/mapstore2-georchestra/mapstore:${{ steps.version.outputs.VERSION }} | |
working-directory: ${{ github.workspace }} | |
- name: Login to GitHub Container Registry | |
if: github.repository == 'geo2france/mapstore2-georchestra' && github.event_name == 'push' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Pushing 2023.02.xx-custom to registry" | |
if: github.ref == 'refs/heads/2023.02.xx-custom' && github.repository == 'geo2france/mapstore2-georchestra' && github.event_name == 'push' | |
run: | | |
docker tag ghcr.io/geo2france/mapstore2-georchestra/mapstore:${{ steps.version.outputs.VERSION }} ghcr.io/geo2france/mapstore2-georchestra/mapstore:2023.02.xx-custom | |
docker push ghcr.io/geo2france/mapstore2-georchestra/mapstore:2023.02.xx-custom | |
working-directory: ${{ github.workspace }} | |
- name: "Pushing tag to registry" | |
if: contains(github.ref, 'refs/tags/') && github.repository == 'geo2france/mapstore2-georchestra' && github.event_name == 'push' | |
run: | | |
docker push ghcr.io/geo2france/mapstore2-georchestra/mapstore:${{ steps.version.outputs.VERSION }} |