Skip to content

Commit

Permalink
Update ci scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Doherty <[email protected]>
  • Loading branch information
chrisdoherty4 committed Jul 23, 2022
1 parent 7d9e396 commit a9125c5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ jobs:
with:
images: quay.io/tinkerbell/rufio
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch,enable=${{ !startsWith(github.ref, 'refs/heads/main') }}
type=ref,event=pr
type=sha
Expand Down
59 changes: 40 additions & 19 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,46 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Login to quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

# This action generates the source image name and should coincide with the build
# from the ci.yaml workflow.
- name: Generate source image
id: src
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=false
tags: |
type=sha
- name: Docker manager metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=false
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# TODO(chrisdoherty4) The meta action generates Docker tags with a 7 character short sha.
# We need to figure out a way to generate that
- name: Push image
uses: akhilerm/[email protected]
with:
src: ${{ steps.src.outputs.tags }}
dst: |
${{ steps.meta.outputs.tags }}
- name: Generate Release Notes
run: |
release_notes=$(gh api repos/{owner}/{repo}/releases/generate-notes -F tag_name=${{ github.ref }} --jq .body)
Expand All @@ -23,25 +63,6 @@ jobs:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}

- name: Docker manager metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=false
tags: type=ref,event=tag

- name: Set the from image tag
run: echo "FROM_TAG=sha-${GITHUB_SHA::8}" >> $GITHUB_ENV

- name: Copy the image using skopeo
run: skopeo copy --all --dest-creds="${DST_REG_USER}":"${DST_REG_PASS}" docker://"${SRC_IMAGE}" docker://"${DST_IMAGE}"
env:
SRC_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.FROM_TAG }}
DST_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
DST_REG_USER: ${{ secrets.QUAY_USERNAME }}
DST_REG_PASS: ${{ secrets.QUAY_PASSWORD }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down

0 comments on commit a9125c5

Please sign in to comment.