Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change image deploy from docker to ghcr #421

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
on: pull_request

# Explicitly grant the `secrets.GITHUB_TOKEN` no permissions.
permissions: {}

jobs:
pre-commit:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -70,3 +74,24 @@ jobs:
node-version: '8.x'
- name: Run frontend tests
run: "npm install grunt-cli && npm install && grunt test"
build-dist-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build
uses: docker/build-push-action@v3
with:
file: Dockerfile
push: false # only build the image, don't push it anywhere
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
46 changes: 36 additions & 10 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,42 @@ jobs:
with:
user: __token__
password: ${{ secrets.pypi_password }}
build-and-publish-docker-image:
name: Build and publish docker image
build-and-publish-to-ghcr:
# Explicitly grant the `secrets.GITHUB_TOKEN` permissions.
permissions:
# Grant the ability to write to GitHub Packages (push Docker images to
# GitHub Container Registry).
packages: write
name: Build and publish Docker images to GitHub Container Registry
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Publish to Registry
uses: elgohr/[email protected]
- uses: actions/checkout@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
# This is the user that triggered the Workflow. In this case, it will
# either be the user whom created the Release or manually triggered
# the workflow_dispatch.
username: ${{ github.actor }}
# `secrets.GITHUB_TOKEN` is a secret that's automatically generated by
# GitHub Actions at the start of a workflow run to identify the job.
# This is used to authenticate against GitHub Container Registry.
# See https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
# for more detailed information.
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
name: lyft/confidant
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_names: true
file: Dockerfile
context: .
push: true # push the image to ghcr
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Loading