-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(registry): use github public docker registry
- Loading branch information
Showing
3 changed files
with
265 additions
and
65 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build and publish docker images | ||
description: Builds and publish docker images to github registry | ||
inputs: | ||
github-token: | ||
description: Github secret secrets.GITHUB_TOKEN | ||
required: true | ||
image-name: | ||
description: Image name for example lh-server | ||
required: true | ||
context: | ||
description: Docker build context path | ||
default: . | ||
dockerfile: | ||
description: Relative route of Dockerfile | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Log in to github registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ inputs.github-token }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }}/${{ input.image-name }} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ inputs.context }} | ||
file: ${{ inputs.dockerfile }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: docker-test | ||
run-name: Docker Test | ||
on: | ||
push: | ||
branches: | ||
- feature/public-registry | ||
permissions: | ||
packages: write | ||
contents: read | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "corretto" | ||
java-version: 17 | ||
- name: Tests | ||
run: ./gradlew server:test | ||
|
||
publish-sdk-java: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: "corretto" | ||
java-version: "11" | ||
- name: Tests | ||
run: ./gradlew sdk-java:test | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Generate KeyRing | ||
run: | | ||
gpg --keyring secring.gpg --export-secret-keys --passphrase ${{ secrets.GPG_PASSPHRASE }} --batch --yes --pinentry-mode=loopback > ~/.gnupg/secring.gpg | ||
ls ~/.gnupg/ | ||
- name: Publish | ||
run: | | ||
./gradlew sdk-java:publish -Psigning.secretKeyRingFile=/home/runner/.gnupg/secring.gpg -Psigning.password=${{ secrets.GPG_PASSPHRASE }} -Psigning.keyId=${{ vars.GPG_KEY_ID }} -PossrhUsername=${{ secrets.OSSRH_USERNAME }} -PossrhPassword=${{ secrets.OSSRH_PASSWORD }} | ||
echo Login at https://s01.oss.sonatype.org/ | ||
publish-sdk-python: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
pip install poetry | ||
- name: Tests | ||
working-directory: ./sdk-python | ||
run: | | ||
poetry install | ||
poetry run python -m unittest -v | ||
poetry build | ||
- name: Publish Package | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages-dir: ./sdk-python/dist/ | ||
|
||
lh-server-docker-image: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and publish | ||
uses: .github/actions/publish-image | ||
with: | ||
image-name: lh-server | ||
dockerfile: docker/server/Dockerfile | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
lh-standalone: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and publish | ||
uses: .github/actions/publish-image | ||
with: | ||
image-name: lh-standalone | ||
dockerfile: docker/standalone/Dockerfile | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
lhctl: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and publish | ||
uses: .github/actions/publish-image | ||
with: | ||
image-name: lhctl | ||
dockerfile: docker/lhctl/Dockerfile | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
lh-dashboard: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Dashboard | ||
working-directory: ./dashboard | ||
run: | | ||
npm install pnpm --global | ||
pnpm install | ||
pnpm build | ||
- name: Build and publish | ||
uses: .github/actions/publish-image | ||
with: | ||
image-name: lhctl | ||
dockerfile: docker/lhctl/Dockerfile | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
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