v0.1.0 #6
Workflow file for this run
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
name: Release | |
on: | |
release: | |
types: [created] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build-artifacts: | |
name: Build Release Artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.78.0 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config libssl-dev | |
- name: Build release | |
run: cargo build --release | |
- name: Rename binary for architecture | |
run: | | |
mv target/release/ghost-resend-mailer target/release/ghost-resend-mailer-x86_64-linux | |
- name: Upload artifacts to release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: target/release/ghost-resend-mailer-x86_64-linux | |
build-and-push-image: | |
name: Push Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
update-release-notes: | |
needs: [build-artifacts, build-and-push-image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Docker Image Info | |
id: image-info | |
run: | | |
# Convert to lowercase for Docker compatibility and remove 'v' prefix from tag | |
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
TAG_NO_V=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//') | |
echo "image=${{ env.REGISTRY }}/${REPO_LOWER}:${TAG_NO_V}" >> $GITHUB_OUTPUT | |
- name: Update Release Notes | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.event.release.tag_name }} | |
body: | | |
${{ github.event.release.body }} | |
## Docker Images | |
Pull the container with: | |
```bash | |
docker pull ${{ steps.image-info.outputs.image }} | |
``` | |
Available platforms: | |
- linux/amd64 |