-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
2fd05c0
commit 6130425
Showing
4 changed files
with
76 additions
and
88 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 |
---|---|---|
@@ -1,47 +1,73 @@ | ||
name: Build, Package and Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
inputs: | ||
release_name: | ||
description: 'Name for the release' | ||
required: true | ||
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: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- 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: Extract version tag | ||
run: echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- 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@v2 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
password: ${{ secrets.RELEASE_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./docker | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
ghcr.io/${{ github.repository }}:${{ env.VERSION_TAG }} | ||
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.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
with: | ||
tag_name: ${{ env.VERSION_TAG }} | ||
tag_name: ${{ inputs.release_name }} | ||
draft: false | ||
prerelease: false |
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
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
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