Skip to content

Commit

Permalink
build: push to github container registry
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Sep 4, 2020
1 parent ca10bd2 commit 304d46b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy to GitHub Container Registry

on:
push:
tags:
- '*'
workflow_dispatch: {}

jobs:
deploy:
name: Deploy to GitHub Container Registry
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build and push Docker image
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
registry: ghcr.io
repository: ${{ github.repository }}
tag_with_ref: true
add_git_labels: true
always_pull: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
FROM alpine

LABEL \
"name"="GitHub Repo Sync" \
"homepage"="https://github.com/marketplace/actions/github-sync" \
"repository"="https://github.com/repo-sync/github-sync" \
"maintainer"="Wei He <[email protected]>"
org.opencontainers.image.title="GitHub Repo Sync" \
org.opencontainers.image.description="⤵️ A GitHub Action for syncing current repository with remote" \
org.opencontainers.image.url="https://github.com/repo-sync/github-sync" \
org.opencontainers.image.documentation="https://github.com/marketplace/actions/github-sync" \
org.opencontainers.image.source="https://github.com/repo-sync/github-sync" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.authors="Wei He <[email protected]>" \
maintainer="Wei He <[email protected]>"

RUN apk add --no-cache git openssh-client && \
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ jobs:
repo-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: repo-sync
uses: repo-sync/github-sync@v2
uses: docker://ghcr.io/repo-sync/github-sync@v2
with:
source_repo: ""
source_branch: ""
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ author: Wei He <[email protected]>
description: ⤵️ Sync current repository with remote
branding:
icon: 'git-branch'
color: 'black'
color: 'gray-dark'
inputs:
source_repo:
description: GitHub public repo slug or full https clone url (with access_token if needed)
Expand Down

0 comments on commit 304d46b

Please sign in to comment.