Skip to content

Commit

Permalink
Merge pull request #1390 from danger/revert-1389-revert-1388-build-to…
Browse files Browse the repository at this point in the history
…-ghcr

Revert "Revert "add build and push to ghcr similar to danger""
  • Loading branch information
orta authored Jul 30, 2023
2 parents 16be6b6 + a430abd commit e36a7e0
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,46 @@ name: Release Danger-JS package

on:
push:
branches:
- 'master'
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3

- name: Export tag version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3

- name: Docker Login
run: echo $PACKAGES_WRITE_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin
env:
PACKAGES_WRITE_TOKEN: ${{ secrets.DOCKER_GITHUB_PASSWORD }}
USERNAME: ${{ secrets.DOCKER_GITHUB_USERNAME }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Build
run: docker build -t ghcr.io/danger/danger-js:$VERSION .
- name: Set up Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
- name: Deploy
run: docker push ghcr.io/danger/danger-js:$VERSION
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit e36a7e0

Please sign in to comment.