Skip to content

Commit

Permalink
Creating first major version #major
Browse files Browse the repository at this point in the history
Refactor build
  • Loading branch information
a-ghanem committed Jan 14, 2022
1 parent 46a9211 commit 7782cfb
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 59 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/ghcr-publish.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Bump version and publish to ghcr.io
on:
push:
branches:
- master

jobs:
tag:
name: bump tags
outputs:
part: ${{ steps.bump_tag.outputs.part }}
tag: ${{ steps.bump_tag.outputs.tag }}
new_tag: ${{ steps.bump_tag.outputs.new_tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '1'
- name: Bump version and push tag
id: bump_tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch

push_to_registry:
needs: tag
if: needs.tag.outputs.part != ''
name: Push Docker image to Github Container registry
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Add Maven Github authentication
run: |
echo "<settings xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd'> <servers> <server> <id>github-clearinghouse</id> <username>${{ github.actor }}</username> <password>${{ secrets.GITHUB_TOKEN }}</password> </server> <server> <id>github-tsd-file-api-client</id> <username>${{ github.actor }}</username> <password>${{ secrets.GITHUB_TOKEN }}</password> </server> </servers> </settings>" > settings.xml
- name: Log in to the Github Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ needs.tag.outputs.tag }}
ghcr.io/${{ github.repository }}:latest
${{ github.repository }}:${{ needs.tag.outputs.tag }}
${{ github.repository }}:latest
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
org.opencontainers.image.revision=${{ github.sha }}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ FROM maven:3.6.1-jdk-13-alpine as builder

COPY pom.xml .

RUN mkdir -p /root/.m2 && \
mkdir /root/.m2/repository

COPY settings.xml /root/.m2

RUN mvn dependency:go-offline --no-transfer-progress

COPY src/ /src/
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@

<repositories>
<repository>
<id>jcenter</id>
<name>jcenter</name>
<url>https://jcenter.bintray.com</url>
<id>github-clearinghouse</id>
<name>elixir-oslo-clearinghouse</name>
<url>https://maven.pkg.github.com/elixir-oslo/clearinghouse</url>
</repository>
<repository>
<id>github-uio-bmi-TSD-File-API-client</id>
<name>uio-bmi-TSD-File-API-client</name>
<url>https://maven.pkg.github.com/uio-bmi/TSD-File-API-client</url>
<id>github-tsd-file-api-client</id>
<name>uio-bmi-tsd-file-api-client</name>
<url>https://maven.pkg.github.com/uio-bmi/tsd-file-api-client</url>
</repository>
</repositories>

Expand Down

0 comments on commit 7782cfb

Please sign in to comment.