Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from wireapp/better-versioning
Browse files Browse the repository at this point in the history
Make the same versioning for the runtime image as well as for the library
  • Loading branch information
LukasForst authored May 13, 2021
2 parents 649d0b1 + 849b4a7 commit 02dac2d
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 83 deletions.
78 changes: 0 additions & 78 deletions .github/workflows/ci.yml

This file was deleted.

101 changes: 101 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Docker Images Release

on:
workflow_dispatch:
schedule:
# At 01:00 on Saturday - build and publish images each saturday at 1:00
- cron: '0 1 * * 6'
release:
types: [ published ]

env:
CRYPTOBOX_IMAGE: wirebot/cryptobox
RUNTIME_IMAGE: wirebot/runtime

jobs:
tests:
name: Execute tests
runs-on: ubuntu-20.04
container: wirebot/cryptobox:latest
steps:
- uses: actions/checkout@v2

- name: Execute Tests
run: |
mvn test -DargLine="-Djava.library.path=$LD_LIBRARY_PATH"
- name: Try to create package
run: |
mvn package -DskipTests
- name: Webhook to Wire
uses: 8398a7/action-slack@v2
with:
status: ${{ job.status }}
author_name: Test execution before release
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_CI }}
if: failure()

docker-release:
name: Release Docker Runtime
runs-on: ubuntu-20.04
needs: [ tests ]
steps:
- uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Set Release Version
# use the version specified in the pom.xml as the tag
run: |
export MVN_VERSION=$(mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.version}' \
--non-recursive \
exec:exec)
echo "RELEASE_VERSION=${MVN_VERSION}" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: wirebot
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and Tag Cryptobox Image
run: |
docker build -f dockerfiles/Dockerfile.cryptobox \
-t ${{ env.CRYPTOBOX_IMAGE }}:latest \
-t ${{ env.CRYPTOBOX_IMAGE }}:${{ env.RELEASE_VERSION }} \
.
- name: Push Cryptobox Image
run: |
docker push ${{ env.CRYPTOBOX_IMAGE }}:latest
docker push ${{ env.CRYPTOBOX_IMAGE }}:${{ env.RELEASE_VERSION }}
- name: Build and Tag Bots Runtime
run: |
docker build -f dockerfiles/Dockerfile.runtime \
-t ${{ env.RUNTIME_IMAGE }}:latest \
-t ${{ env.RUNTIME_IMAGE }}:${{ env.RELEASE_VERSION }} \
.
- name: Push Runtime Image
run: |
docker push ${{ env.RUNTIME_IMAGE }}:latest
docker push ${{ env.RUNTIME_IMAGE }}:${{ env.RELEASE_VERSION }}
# Send webhook to Wire using Slack Bot
- name: Webhook to Wire
uses: 8398a7/action-slack@v2
with:
status: ${{ job.status }}
author_name: Cryptobox4j - Wire Bot Runtime Docker Release
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_CI }}
# Send message only if previous step failed
if: always()
1 change: 1 addition & 0 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
tests:
name: Execute tests
runs-on: ubuntu-20.04
container: wirebot/cryptobox:latest
steps:
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,37 @@ on:
workflow_dispatch:
pull_request:

env:
CRYPTOBOX_IMAGE: wirebot/cryptobox
RUNTIME_IMAGE: wirebot/runtime

jobs:
native-build:
tests:
name: Execute tests
runs-on: ubuntu-20.04
container: wirebot/cryptobox:latest
steps:
- uses: actions/checkout@v2

- name: Execute Tests
run: |
mvn test -DargLine="-Djava.library.path=$LD_LIBRARY_PATH";
mvn test -DargLine="-Djava.library.path=$LD_LIBRARY_PATH"
- name: Try to create package
run: |
mvn package -DskipTests
docker-build:
name: Try to build the docker images
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Build and Tag Cryptobox Image
run: |
docker build -f dockerfiles/Dockerfile.cryptobox -t ${{ env.CRYPTOBOX_IMAGE }}:latest .
- name: Build and Tag Bots Runtime
run: |
docker build -f dockerfiles/Dockerfile.runtime -t ${{ env.RUNTIME_IMAGE }}:latest .
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ See makefiles in [mk](mk) directory.
<dependency>
<groupId>com.wire</groupId>
<artifactId>cryptobox4j</artifactId>
<version>0.5.0</version>
<version>1.0.0</version>
</dependency>
```
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.runtime
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPY --from=cryptobox /wire/cryptobox/dist/lib /opt/wire/lib
# copy prometheus agent
COPY --from=cryptobox /wire/cryptobox/dist/jar/prometheus-agent.jar /opt/wire/lib/
# copy metrics seettings
COPY metrics.yaml /opt/wire/lib/metrics.yaml
COPY dockerfiles/metrics.yaml /opt/wire/lib/metrics.yaml

# enable crypto https://stackoverflow.com/a/42163925/7169288
# it should be enabled by default, we're doing this just to be sure
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.wire</groupId>
<artifactId>cryptobox4j</artifactId>
<version>0.5.2</version>
<version>1.0.0</version>

<name>Cryptobox4J</name>
<description>CryptoBox for Wire Bots</description>
Expand Down

0 comments on commit 02dac2d

Please sign in to comment.