diff --git a/.github/workflows/build-tag.yml b/.github/workflows/build-tag.yml new file mode 100644 index 0000000..d39e06d --- /dev/null +++ b/.github/workflows/build-tag.yml @@ -0,0 +1,62 @@ +name: Build Release JARs and docker containers + +on: + push: + tags: + - '*' + + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'adopt' + + - name: Build JAR + run: ./mvnw package + + - name: release + uses: actions/create-release@v1 + id: create_release + with: + draft: false + prerelease: false + release_name: ${{ steps.version.outputs.version }} + tag_name: ${{ github.ref }} + body: my wonderful release ${{ github.ref_name }} + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: upload linux artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: target/twelve-factor-demo.jar + asset_name: twelve-factor-demo-${{ github.ref_name }}.jar + asset_content_type: application/zip + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker registry + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker container + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: intesys/twelve-factor-app-kotlin:${{ github.ref_name }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..017def6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: Build JARs and docker containers + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '21' + distribution: 'adopt' + + - name: Build JAR + run: ./mvnw package + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to Docker registry + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker container + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: intesys/twelve-factor-app-kotlin:latest + + - name: Upload JAR artifact + uses: actions/upload-artifact@v2 + with: + name: twelve-factor-demo.jar + path: target/twelve-factor-demo.jar