Skip to content

Commit

Permalink
Merge pull request #16 from lsst-it/IT-4385/ghcr.io
Browse files Browse the repository at this point in the history
migrate from hub.docker.com -> ghcr.io
  • Loading branch information
jhoblitt authored Mar 15, 2023
2 parents f3ebfaa + e988beb commit 6593612
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
# based on https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md

name: ci

on:
"on":
workflow_dispatch: {}
schedule:
- cron: '0 10 * * 1'
push:
Expand All @@ -13,23 +15,32 @@ on:
pull_request:
branches:
- 'main'
- 'master'

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

jobs:
release:
runs-on: ubuntu-latest
if: github.repository == 'lsst-it/foreman_envsync'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true

- name: Run the default task
run: bundle exec rake

- name: Build gem
run: gem build *.gemspec

- name: Publish gem to rubygems.org
if: startsWith(github.ref, 'refs/tags/v')
run: gem push *.gem
Expand All @@ -40,18 +51,30 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: |
lsstit/foreman_envsync
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Login to OCI registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_LSSTIT_USERNAME }}
password: ${{ secrets.DOCKERHUB_LSSTIT_PASSWORD }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source "https://rubygems.org"
gemspec

gem "rake", "~> 13.0"

gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.7"
gem "rubocop-rake", "~> 0.6"
gem "rubocop-rspec", "~> 2.19"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ classes within those puppet environments.
## OCI Image

An OCI image containing this gem is published to docker hub as
[`lsstit/foreman_envsync`](https://hub.docker.com/repository/docker/lsstit/foreman_envsync).
[`ghcr.io/lsst-it/foreman_envsync`](ghcr.io/lsst-it/foreman_envsync).


## The Problem
Expand Down
2 changes: 0 additions & 2 deletions foreman_envsync.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "hammer_cli_foreman"
spec.add_runtime_dependency "hammer_cli_foreman_puppet"
spec.add_runtime_dependency "rest-client", "~> 2.0"
spec.add_development_dependency "rubocop-rake"
spec.add_development_dependency "rubocop-rspec"

# For more information and examples about making a new gem, checkout our
# guide at: https://bundler.io/guides/creating_gem.html
Expand Down

0 comments on commit 6593612

Please sign in to comment.