-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ env: | |
|
||
jobs: | ||
build-and-push: | ||
name: 🐳 Build and Push Docker Image | ||
name: 🐳 Build and Push Docker Images | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
|
@@ -35,12 +35,21 @@ jobs: | |
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.target_arch }} | ||
tags: | | ||
type=ref,event=tag | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
type=edge,branch=main | ||
labels: | | ||
org.opencontainers.image.title=${{ env.IMAGE_NAME }} | ||
org.opencontainers.image.description=Data Proxy Service for Seda Protocol | ||
org.opencontainers.image.version=${{ steps.meta.outputs.version }} | ||
org.opencontainers.image.architecture=${{ matrix.target_arch }} | ||
org.opencontainers.image.source=${{ github.repository }} | ||
org.opencontainers.image.url=https://github.com/${{ github.repository }} | ||
org.opencontainers.image.created=${{ steps.meta.outputs.created }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
- name: 🛠️ Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
@@ -52,7 +61,7 @@ jobs: | |
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: 🏗️ Build and push Docker image | ||
- name: 🏗️ Build and push Docker image for ${{ matrix.target_arch }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
|
@@ -66,23 +75,31 @@ jobs: | |
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: ✨ Save image details | ||
run: echo "${{ steps.meta.outputs.tags }}" > image-details.txt | ||
- name: ✨ Collect image info | ||
run: echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.target_arch }}:${{ steps.meta.outputs.version }}" >> $GITHUB_WORKSPACE/image-urls.txt | ||
|
||
- name: 📦 Upload image details as artifact | ||
- name: 📦 Upload image info as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: image-details | ||
path: image-details.txt | ||
name: image-urls | ||
path: $GITHUB_WORKSPACE/image-urls.txt | ||
if: ${{ always() }} | ||
|
||
create-release: | ||
name: 📦 Create GitHub Release | ||
needs: build-and-push | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 📥 Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: 🔽 Download image info artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: image-urls | ||
path: ./artifacts/ | ||
|
||
- name: 📝 Generate Changelog | ||
id: changelog | ||
uses: TriPSs/[email protected] | ||
|
@@ -94,24 +111,24 @@ jobs: | |
skip-git-pull: true | ||
git-push: false | ||
|
||
- name: 🔽 Download image details artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: image-details | ||
path: ./image-details.txt | ||
- name: 📦 Prepare Release Notes | ||
id: release_notes | ||
run: | | ||
echo "## Changelog" > release-body.md | ||
echo "${{ steps.changelog.outputs.changelog }}" >> release-body.md | ||
echo "" >> release-body.md | ||
echo "## Docker Images" >> release-body.md | ||
echo "The following Docker images were built and published to GHCR:" >> release-body.md | ||
echo "" >> release-body.md | ||
while read -r line; do | ||
echo "- [$line](${line})" >> release-body.md | ||
done < ./artifacts/image-urls.txt | ||
- name: 🎉 Create GitHub Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
allowUpdates: true | ||
generateReleaseNotes: true | ||
body: | | ||
${{ steps.changelog.outputs.changelog }} | ||
## Docker Images | ||
The following Docker images were built and published: | ||
``` | ||
${{ steps.changelog.outputs.changelog }} | ||
${{ steps.release.outputs.uploaded }} | ||
``` | ||
tag: ${{ github.ref_name }} | ||
name: ${{ github.ref_name }} | ||
body: ${{ steps.release_notes.outputs.body }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |