Skip to content

Commit 6e44783

Browse files
committed
chore(github/workflows): update release docker to run for tags
1 parent 8b982cf commit 6e44783

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

.github/workflows/release-docker.yml

+22-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- v* # Match version tags like v1.0.0
79
workflow_dispatch:
810

911
env:
@@ -13,33 +15,47 @@ env:
1315
jobs:
1416
build:
1517
runs-on: ubuntu-latest
18+
1619
steps:
20+
# Step 1: Checkout the repository
1721
- uses: actions/checkout@v4
1822

19-
# Install Rust and cross-compile the binary in release mode
23+
# Step 2: Set up Rust
2024
- name: Set up Rust
2125
uses: actions-rs/toolchain@v1
2226
with:
2327
profile: minimal
2428
toolchain: stable
2529

30+
# Step 3: Build the binary in release mode
2631
- name: Build in release mode
2732
run: cargo build --release --verbose
2833

34+
# Step 4: Install scru128-cli from GitHub
2935
- name: Install scru128-cli from GitHub
3036
run: |
3137
cargo install --git https://github.com/cablehead/scru128-cli --branch main
3238
mv ~/.cargo/bin/scru128 target/release/scru128
3339
34-
# Create a Docker image, using the Dockerfile from the .github/workflows directory
40+
# Step 5: Determine Docker image tag based on ref type
41+
- name: Determine image tag
42+
id: image_tag
43+
run: |
44+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
45+
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
46+
else
47+
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
48+
fi
49+
50+
# Step 6: Build Docker image
3551
- name: Build Docker image
3652
run: |
37-
docker build -t $IMAGE_NAME:latest -f .github/workflows/Dockerfile.release-docker .
53+
docker build -t $IMAGE_NAME:$IMAGE_TAG -f .github/workflows/Dockerfile.release-docker .
3854
39-
# Log in to the GitHub Container Registry (GHCR)
55+
# Step 7: Log in to GitHub Container Registry
4056
- name: Log in to GitHub Container Registry
4157
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
4258

43-
# Push the Docker image to GHCR
59+
# Step 8: Push Docker image to GHCR
4460
- name: Push Docker image
45-
run: docker push $IMAGE_NAME:latest
61+
run: docker push $IMAGE_NAME:$IMAGE_TAG

notes/how-to-release.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cargo publish
1313
cargo install cross-stream --locked
1414
1515
rm ~/bin/xs
16+
brew uninstall cross-stream
1617
which xs # should be /Users/andy/.cargo/bin/xs
1718
# test the new version
1819
@@ -29,7 +30,6 @@ shasum -a 256 $tarball
2930
3031
# update: [email protected]:cablehead/homebrew-tap.git
3132
32-
brew uninstall cross-stream
3333
brew install cablehead/tap/cross-stream
3434
which xs # should be /opt/homebrew/bin/xs
3535
# test the new version

0 commit comments

Comments
 (0)