Skip to content
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
18 changes: 1 addition & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.2.3
node: circleci/node@5.0.0
docker: circleci/docker@2.2.0

jobs:
run-tests:
build:
parallelism: 1
docker:
- image: cimg/ruby:3.2.2-browsers
Expand Down Expand Up @@ -108,18 +107,3 @@ jobs:
name: Run system tests
command: |
COVERAGE=false bundle exec rspec spec/system/

workflows:
test-build-and-publish-image:
jobs:
- run-tests
- docker/publish:
cache_from: stringerrss/stringer:latest
image: stringerrss/stringer
tag: latest,$CIRCLE_SHA1
update-description: false
requires:
- run-tests
filters:
branches:
only: main
56 changes: 56 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build Docker image and push to Dockerhub

on:
push
env:
IMAGE_NAME: stringerrss/stringer

jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Extract Docker sha tag
id: get-tag-sha
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: type=sha

- name: Extract Docker latest tag
id: get-tag-latest
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: type=raw, value=latest

- name: Log in to Docker Hub
if: ${{ github.ref_name == 'main' }}
id: login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.ref_name == 'main' }}
tags: |
${{ steps.get-tag-latest.outputs.tags }}
${{ steps.get-tag-sha.outputs.tags }}
cache-from: type=gha

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this cache-from will cache to/from the Github Actions environment, so there's no need to pull an image locally, but I'm not 100% confident.

cache-to: type=gha