Skip to content

Build, Package and Release #10

Build, Package and Release

Build, Package and Release #10

name: Build, Package and Release
on:
workflow_dispatch:
inputs:
release_name:
description: 'Name for the release'
required: true
type: string
stellar_cli_version:
description: 'Stellar CLI version'
required: false
type: string
rust_version:
description: 'Rust version'
required: false
type: string
permissions:
contents: write
jobs:
build_and_docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_TOKEN }}
- name: Configure git
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Update soroban-build-workflow version
run: sed -i 's/ghcr.io\/stellar-expert\/soroban-build-workflow:[^"]*/ghcr.io\/stellar-expert\/soroban-build-workflow:${{ inputs.release_name }}/' .github/workflows/release.yml
- name: Commit and push changes using gh
run: |
if git diff --exit-code; then
echo "No changes to commit."
exit 0
fi
git add .github/workflows/release.yml
git commit -m "Update version to ${{ inputs.release_name }}"
gh auth setup-git
git push
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR using a PAT
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.RELEASE_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./docker
push: true
build-args: |
STELLAR_CLI_VERSION=${{ inputs.stellar_cli_version }}
RUST_VERSION=${{ inputs.rust_version }}
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:${{ inputs.release_name }}
ghcr.io/${{ github.repository }}:latest
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: ${{ inputs.release_name }}
draft: false
prerelease: false