-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds initial package and release workflows
- Loading branch information
Showing
3 changed files
with
108 additions
and
1 deletion.
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
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,61 @@ | ||
name: Package (pre-release) | ||
|
||
env: | ||
GITHUB_SHA: ${{ github.sha }} | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}/vospace | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
package-docker: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Init - register short hash | ||
run: echo SHA_SHORT="${GITHUB_SHA::7}" >> $GITHUB_ENV | ||
|
||
- name: Init - register image tag | ||
run: echo IMAGE_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.SHA_SHORT }}" >> $GITHUB_ENV | ||
|
||
- name: Build - build local ANT image | ||
run: docker build -f Dockerfile.ApacheAnt -t apache-ant . | ||
|
||
- name: Build - create VOSpace Java build with ANT | ||
run: docker run --rm -v ./java:/app apache-ant dist | ||
|
||
- name: Package - build VOSpace image | ||
run: docker build --file Dockerfile --tag ${{ env.IMAGE_TAG }} . | ||
|
||
- name: Test - Start VOSpace container | ||
run: | | ||
docker run -d \ | ||
--env-file .env.example \ | ||
--name vospace-example \ | ||
--port 3001:8080/tcp \ | ||
${{ env.IMAGE_TAG }} | ||
- name: Test - perform health checks | ||
run: | | ||
curl \ | ||
--fail \ | ||
--connect-timeout 10 \ | ||
--retry 3 \ | ||
--retry-delay 5 \ | ||
--retry-max-time 40 \ | ||
--retry-all-errors \ | ||
-o /dev/null \ | ||
http://localhost:3001/vospace-2.0/vospace/ | ||
- name: Publish - Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish - Push the new tag | ||
run: docker push ${{ env.IMAGE_TAG }} |
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,47 @@ | ||
name: Version Release | ||
on: | ||
release: | ||
types: [released] | ||
|
||
env: | ||
GITHUB_SHA: ${{ github.sha }} | ||
|
||
jobs: | ||
|
||
release-docker: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}/vospace | ||
RELEASE_TAG: ${{ github.ref_name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: generate short hash | ||
run: echo BUILD_SHA="${GITHUB_SHA::7}" >> $GITHUB_ENV | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Pull the existing image for this commit | ||
run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_SHA }} | ||
|
||
- name: Create the new tag | ||
run: docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_SHA }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RELEASE_TAG }} | ||
|
||
- name: Push the new tag | ||
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RELEASE_TAG }} | ||
|
||
- name: Create the latest tag | ||
run: docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_SHA }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
|
||
- name: Push the latest tag | ||
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
|
||
- name: Cleanup left over docker data | ||
run: rm -rf ~/.docker |