Skip to content

Commit

Permalink
Update release.yml to use re-usable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarow authored Aug 14, 2023
1 parent 4ac8f78 commit 0978859
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,5 @@ on:
jobs:

build-and-release-image:
name: "Build and release container image"
runs-on: "ubuntu-latest"
env:
IMAGE_NAME: "nsidc/usaon-vta-survey"
# GitHub Actions expressions don't have great conditional support, so
# writing a ternary expression looks a lot like bash. In Python, this
# would read as:
# github.event.release.tag_name if github.event_name == 'release' else 'latest'
# https://docs.github.com/en/actions/learn-github-actions/expressions
IMAGE_TAG: "${{ github.event_name == 'release' && github.event.release.tag_name || 'latest' }}"
steps:
- name: "Check out repository"
uses: "actions/checkout@v3"

- name: "Build container image"
run: |
docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" .
- name: "DockerHub login"
uses: "docker/login-action@v2"
with:
username: "${{secrets.DOCKER_USER}}"
password: "${{secrets.DOCKER_PASS}}"

- name: "GHCR login"
uses: "docker/login-action@v2"
with:
registry: "ghcr.io"
username: "${{ github.repository_owner }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: "Push to DockerHub and GHCR"
run: |
docker push "${IMAGE_NAME}:${IMAGE_TAG}"
docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "ghcr.io/${IMAGE_NAME}:${IMAGE_TAG}"
docker push "ghcr.io/${IMAGE_NAME}:${IMAGE_TAG}"
uses: "nsidc/.github/.github/workflows/build-and-publish-container-image.yml@main"
secrets: "inherit"

0 comments on commit 0978859

Please sign in to comment.