Skip to content

Merge pull request #50 from Azure/gk/fix-deps #12

Merge pull request #50 from Azure/gk/fix-deps

Merge pull request #50 from Azure/gk/fix-deps #12

name: package-virtual-worker
on:
push:
branches:
- 'main'
paths:
- 'makeline-service/**'
workflow_dispatch:
jobs:
set-env:
name: Set Environment Variables
runs-on: ubuntu-latest
outputs:
version: ${{ steps.main.outputs.version }}
created: ${{ steps.main.outputs.created }}
project: ${{ steps.main.outputs.project }}
image: ${{ steps.main.outputs.image }}
repository: ${{ steps.main.outputs.repository }}
steps:
- id: main
run: |
echo ::set-output name=version::$(echo ${GITHUB_SHA} | cut -c1-7)
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=project::virtual-worker
echo ::set-output name=image::reddog-java-virtual-worker
echo ::set-output name=repository::ghcr.io/azure/reddog-demo
package-service:
name: Package Service
runs-on: ubuntu-latest
needs: set-env
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.2
- name: Build with Maven
run: mvn -B package --file ./virtual-worker/pom.xml
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
- name: Build Docker container and push
uses: docker/build-push-action@v2
with:
context: virtual-worker
file: virtual-worker/Dockerfile
push: true
tags: |
${{ needs.set-env.outputs.repository }}/${{ needs.set-env.outputs.image }}:latest
${{ needs.set-env.outputs.repository }}/${{ needs.set-env.outputs.image }}:${{ needs.set-env.outputs.version }}
labels: |
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.created=${{ needs.set-env.outputs.created }}
org.opencontainers.image.revision=${{ needs.set-env.outputs.version }}