Skip to content

Commit

Permalink
ci: add deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger authored May 9, 2024
1 parent 1940141 commit d168b4d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "deploy"

on:
push:
branches: ["main"]

concurrency:
cancel-in-progress: true
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"

jobs:
deploy:
runs-on: "ubuntu-latest"
outputs:
image-json: "${{ steps.publish.outputs.imageJson }}" # output produced from printJibMeta Gradle task
steps:
- name: "checkout"
uses: "actions/checkout@v4"
- name: "setup environment"
uses: "./.github/actions/setup-env/"
- name: "check"
run: ./gradlew check
- name: "login"
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: "publish"
id: publish
run: "./gradlew jib -Djib.console=plain"
promote:
needs: "deploy"
runs-on: "ubuntu-latest"
environment: "promoted"
steps:
- name: "login"
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: "tag"
env:
IMAGE_ID: "${{ fromJSON(needs.deploy.outputs.image-json).imageId }}"
IMAGE_NAME: "${{ fromJSON(needs.deploy.outputs.image-json).image }}"
PROMOTED_TAG_NAME: "stable"
run: |
skopeo copy -a "docker://$IMAGE_NAME@$IMAGE_ID" "docker://$IMAGE_NAME:$PROMOTED_TAG_NAME"

0 comments on commit d168b4d

Please sign in to comment.