Skip to content

Commit

Permalink
geocat: customize runs
Browse files Browse the repository at this point in the history
proxy, nx, docker, github actions
  • Loading branch information
fgravin authored and jahow committed Sep 26, 2023
1 parent 6ccf44e commit a96c3e2
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 26 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run-name: 📦 Generate artifacts for ${{ github.event_name == 'issue_comment' &
on:
push:
branches:
- main
- geocat
release:
types: [published]
issue_comment:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
main-branch-name: 'geocat'

- name: Install dependencies
run: npm ci
Expand Down Expand Up @@ -91,16 +91,19 @@ jobs:

- name: Tag all docker images on main also as latest
if: github.event_name == 'push' # only happens when pushing on the main branch
run: docker image ls --format 'docker tag {{.Repository}}:{{.Tag}} {{.Repository}}:latest' --filter=reference='geonetwork/*' | bash -
run: docker image ls --format 'docker tag {{.Repository}}:{{.Tag}} {{.Repository}}:latest' --filter=reference='camptocamp/*' | bash -

- name: Login to DockerHub
- name: Login to Github Packages
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push all docker images
# list all docker images, keep only the ones in the geonetwork org, and call docker push for each of them
run: |
docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='geonetwork/*' | \
docker image ls --format '{{.Repository}}:{{.Tag}}' --filter=reference='camptocamp/*' | \
xargs -I '{}' docker tag '{}' ghcr.io/'{}'
docker image ls --format '{{.Repository}}:{{.Tag}}' |grep ghcr.io | \
xargs -r -L1 docker push $1
16 changes: 9 additions & 7 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ env:
on:
push:
branches:
- main
- geocat
pull_request:
types: [opened, synchronize, ready_for_review]

# Only allow concurrent checks on the main branch to keep history
# on QA checks
concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
cancel-in-progress: ${{ github.ref_name != 'geocat' }}

jobs:
format-lint-test:
Expand All @@ -40,16 +40,16 @@ jobs:
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'main'
main-branch-name: 'geocat'
- run: npm ci
- run: npx nx format:check
- run: npx nx affected -t lint --parallel=3
- run: npx nx affected -t test --parallel=3 --configuration=ci --ci --codeCoverage --coverageReporters=lcov

- name: Coveralls
uses: coverallsapp/github-action@v2
with:
allow-empty: true
# - name: Coveralls
# uses: coverallsapp/github-action@v2
# with:
# allow-empty: true

# - name: Archive Code Coverage Results (on main)
# if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -115,6 +115,8 @@ jobs:

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
with:
main-branch-name: 'geocat'

- name: Install dependencies
run: npm ci
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
on:
push:
branches:
- main
- geocat
issue_comment:
types:
- edited
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
name: Deploy Storybook to GitHub Pages
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{needs.checks.outputs.ref || 'main'}}
BRANCH_NAME: ${{needs.checks.outputs.ref || 'geocat'}}

steps:
- name: Dump GitHub event
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ run-name: 🐺 Run Snyk on ${{ github.event_name == 'pull_request' && 'PR' || '

on:
push:
branches: ['main']
branches: ['geocat']
pull_request:
types: [opened, synchronize, ready_for_review]

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/webcomponents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ run-name: 🧩 Build Web Components for ${{ github.event_name == 'issue_comment'
on:
push:
branches:
- main
tags:
- 'v*.*.*'
- geocat
release:
types: [published]

Expand Down Expand Up @@ -56,10 +54,10 @@ jobs:
tag: ${{ github.ref }}
overwrite: true

- name: Publish web component to ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }} branch
- name: Publish web component to ${{ env.PUBLISH_BRANCH }} branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_dir: ./wc-dist
publish_branch: ${{ env.PUBLISH_BRANCH }}-${{ github.ref_name }}
publish_branch: ${{ env.PUBLISH_BRANCH }}
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"affected": {
"defaultBase": "remotes/origin/main"
"defaultBase": "remotes/geocat/geocat"
},
"npmScope": "geonetwork-ui",
"tasksRunnerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion proxy-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
'/geonetwork': {
target: 'http://localhost:8080',
target: 'https://www.geocat.ch',
secure: true,
logLevel: 'debug',
changeOrigin: true,
Expand Down
4 changes: 2 additions & 2 deletions tools/print-docker-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ gitTag=$(git describe --exact-match --tags 2>/dev/null | sed "s/^v//") # remove
gitBranch=$(git symbolic-ref --short HEAD)
gitRef=$(git rev-parse --short HEAD)
dockerTag=${gitTag:-${gitBranch}}
if [ ${dockerTag} == "main" ]; then
if [ ${dockerTag} == "geocat" ]; then
dockerTag=${dockerTag}-${gitRef}
fi

echo "geonetwork/geonetwork-ui-${appName}:${dockerTag}"
echo "camptocamp/geocat-geonetwork-ui-${appName}:${dockerTag}"

0 comments on commit a96c3e2

Please sign in to comment.