-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (73 loc) · 2.33 KB
/
docker-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build, Package and Release
on:
workflow_dispatch:
inputs:
release_name:
description: 'Name for the release'
required: true
type: string
soroban_cli_version:
description: 'Soroban 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: |
SOROBAN_CLI_VERSION=${{ inputs.soroban_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