Skip to content

Commit

Permalink
move buil and docker jobs to tag workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
meghaniankov committed Jan 9, 2024
1 parent d4ad799 commit 656b8a4
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 7 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: push

on: push
on:
push:
branches:
- '**'

permissions:
contents: read
Expand Down Expand Up @@ -53,13 +56,10 @@ jobs:
uses: docker/metadata-action@v4
with:
images: quay.io/uswitch/terrafying-components
tags: |
type=sha,prefix=,format=long,
type=semver,pattern={{version}}
tags: type=sha,prefix=,format=long,
- uses: docker/build-push-action@v4
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: "TERRAFYING_VERSION=${{ contains(github.ref, 'refs/tags/') && github.ref_name || '0.0.0' }}"
tags: ${{ steps.meta.outputs.tags }}
57 changes: 56 additions & 1 deletion .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,69 @@ permissions:
id-token: write

jobs:
build:
runs-on: ubuntu-latest
env:
GHA_TERRAFYING_VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.2.2
- run: rake version
- run: rake build
- uses: actions/upload-artifact@v3
with:
name: pkg
path: |
pkg/
lib/
push:
needs: build
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
GHA_TERRAFYING_VERSION: ${{ github.ref_name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.2.2
- uses: actions/download-artifact@v3
with:
name: pkg
path: ./
- run: rake push

docker:
needs: build
runs-on: ubuntu-latest
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
steps:
- uses: actions/checkout@v4
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: actions/download-artifact@v3
with:
name: pkg
path: ./
- id: meta
uses: docker/metadata-action@v4
with:
images: quay.io/uswitch/terrafying
tags: type=semver,pattern={{version}}
- uses: docker/build-push-action@v4
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: "TERRAFYING_VERSION=${{ github.ref_name }}"

0 comments on commit 656b8a4

Please sign in to comment.