Skip to content

antarcticrainforest is preparing the next release #65

antarcticrainforest is preparing the next release

antarcticrainforest is preparing the next release #65

Workflow file for this run

name: Build and publish the container image
run-name: ${{ github.actor }} is preparing the next release
"on":
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
tests:
uses: ./.github/workflows/ci_job.yml
docs:
runs-on: ubuntu-latest
needs: tests
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.X"
- name: Install freva rest dependencies
run: |
python3 -m pip install -e ./freva-rest[dev] ./freva-data-portal-worker
- name: Generate self signed keys
run: python dev-env/config/dev-utils.py gen-certs
- name: Set up services
run: |
docker compose -f dev-env/docker-compose.yaml up -d --remove-orphans
- name: Waiting for keycloak
run: >
python dev-env/config/dev-utils.py oidc
http://localhost:8080/realms/freva/.well-known/openid-configuration
- name: Starting the local server
run: |
python run_server.py -c api_config.toml --debug --dev -p 7777
- name: Creating docs
run: tox -e docs
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
# Upload entire repository
path: './docs/build/html'
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
build-and-push-image:
runs-on: ubuntu-latest
needs: tests
permissions:
contents: read
packages: write
steps:
-
name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.X"
-
name: Get tag
id: repository
run: |
echo "repo=$(echo ${{ github.repository }}|tr 'A-Z' 'a-z')" >> $GITHUB_OUTPUT
echo "tag=$(python freva-rest/src/freva_rest/__init__.py)" >> $GITHUB_OUTPUT
-
name: Check if tag is a pre-release
id: check-prerelease
run: |
TAG=${{ steps.repository.outputs.tag }}
if [[ "$TAG" == *"-dev"* || "$TAG" == *"-beta"* || "$TAG" == *"-alpha"* ]]; then
echo "This is a pre-release tag."
echo "LATEST_TAG=${{ steps.repository.outputs.tag }}" >> $GITHUB_ENV
else
echo "This is not a pre-release tag."
echo "LATEST_TAG=latest" >> $GITHUB_ENV
fi
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}
-
name: Build and push freva-rest API image
uses: docker/build-push-action@v4
with:
build-args: VERSION=${{steps.repository.outputs.tag}}
platforms: linux/amd64
push: true
tags: |
ghcr.io/freva-clint/freva-rest-api:${{ steps.repository.outputs.tag }}
ghcr.io/freva-clint/freva-rest-api:${{ env.LATEST_TAG }}
pypi:
name: Create Pip package
permissions:
id-token: write
needs: [tests, build-and-push-image, docs]
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
-
name: Install flit
run: python -m pip install flit
-
name: Building freva-client 📦 with flit
run: flit build
working-directory: freva-client
-
name: publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
verbose: true
packages-dir: freva-client/dist
bump-databrowser-version:
runs-on: ubuntu-latest
needs: [build-and-push-image, docs]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.X"
- name: Pull the latest solr image
run: docker pull solr:latest
- name: Get the latest solr version
id: solr
run: echo tag=$(docker inspect solr:latest -f '{{index .Config.Labels "org.opencontainers.image.version"}}') >> $GITHUB_OUTPUT
- name: Get tag
id: repository
run: |
echo "repo=$(echo ${{ github.repository }}|tr 'A-Z' 'a-z')" >> $GITHUB_OUTPUT
echo "tag=$(python freva-rest/src/freva_rest/__init__.py)" >> $GITHUB_OUTPUT
- name: Installing dependencies
run: pip install git-python packaging tomli requests
- name: Getting realease job
run: curl -Ls -o bump.py https://raw.githubusercontent.com/FREVA-CLINT/freva-deployment/main/release.py
- name: Do the release job
run: python3 bump.py deploy freva_rest -p freva-rest -v -s solr ${{steps.solr.outputs.tag}}
env:
GITHUB_TOKEN: ${{secrets.ACCESS_TOKEN}}
REPO_VERSION: ${{ steps.repository.outputs.tag }}