Skip to content

Commit b1121f0

Browse files
Add github release workflow
Signed-off-by: Matthew DeVenny <matt@boxboat.com>
1 parent 2156403 commit b1121f0

3 files changed

Lines changed: 27 additions & 20 deletions

File tree

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
!cmd/
33
!dockcmd.go
44
!go.*
5-
!Makefile
5+
!Makefile

.github/workflows/main.yaml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
- name: Setup Go
1313
uses: actions/setup-go@v2
1414
with:
15-
go-version: '^1.19'
15+
go-version: '1.19'
16+
check-latest: true
1617

1718
- name: Print Go Version
1819
run: go version
@@ -23,10 +24,12 @@ jobs:
2324
echo ${GITHUB_REF}
2425
tag=${GITHUB_REF#refs/tags/}
2526
publish="no"
27+
release="no"
2628
if [ "${tag}" != "${GITHUB_REF}" ]; then
2729
tag=$(echo "${tag}" | sed -e 's/[^a-zA-Z0-9\-\.]/-/g')
2830
version=${tag}
2931
publish="yes"
32+
release="yes"
3033
fi
3134
3235
branch=${GITHUB_REF#refs/heads/}
@@ -50,6 +53,7 @@ jobs:
5053
else
5154
echo CI_VERSION=${version} >> $GITHUB_ENV
5255
echo PUBLISH=${publish} >> $GITHUB_ENV
56+
echo RELEASE=${release} >> $GITHUB_ENV
5357
fi
5458
5559
- name: Build
@@ -60,19 +64,27 @@ jobs:
6064
make
6165
fi
6266
63-
- uses: google-github-actions/setup-gcloud@v0
64-
if: ${{ env.PUBLISH == 'yes' }}
65-
with:
66-
version: '290.0.1'
67-
project_id: ${{ secrets.GCP_PROJECT_ID }}
68-
service_account_key: ${{ secrets.GCP_SA_KEY }}
69-
export_default_credentials: true
70-
71-
- name: Publish
72-
if: ${{ env.PUBLISH == 'yes' }}
67+
- name: Release Artifacts
68+
if: ${{ env.RELEASE == 'yes' }}
7369
run: |
74-
cd ./release;
75-
gsutil -m -q cp -r -a public-read . gs://boxops/dockcmd/releases/
70+
gh release create ${CI_VERSION} --draft --verify-tag --title "Release ${CI_VERSION}"
71+
gh release upload ${CI_VERSION} ./release/*.zip
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
# - uses: google-github-actions/setup-gcloud@v0
76+
# if: ${{ env.PUBLISH == 'yes' }}
77+
# with:
78+
# version: '290.0.1'
79+
# project_id: ${{ secrets.GCP_PROJECT_ID }}
80+
# service_account_key: ${{ secrets.GCP_SA_KEY }}
81+
# export_default_credentials: true
82+
83+
# - name: Publish
84+
# if: ${{ env.PUBLISH == 'yes' }}
85+
# run: |
86+
# cd ./release;
87+
# gsutil -m -q cp -r -a public-read . gs://boxops/dockcmd/releases/
7688

7789
- name: Set up QEMU
7890
if: ${{ env.PUBLISH == 'yes' }}
@@ -111,9 +123,3 @@ jobs:
111123
tags: |
112124
boxboat/dockcmd:${{ env.CI_VERSION }}
113125
ghcr.io/boxboat/dockcmd:${{ env.CI_VERSION }}
114-
115-
# - name: Docker Hub Release
116-
# if: ${{ steps.version.outputs.PUBLISH == 'yes' }}
117-
# run: make docker
118-
# env:
119-
# CI_VERSION: ${{ steps.version.outputs.CI_VERSION }}

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ $(RELEASE_TARGETS):
4444
GOOS=$(os) GOARCH=$(arch) CGO_ENABLED=0 go build \
4545
-ldflags="-w -s -X main.Version=$(VERSION) -X github.com/boxboat/dockcmd/cmd.EnableDebug=$(DEBUG)" \
4646
-o ./release/$(os)-$(arch)/$(VERSION)/
47+
zip -j ./release/dockcmd-$(os)-$(arch).zip ./release/$(os)-$(arch)/$(VERSION)/*
4748

4849
docker:
4950
docker buildx build \

0 commit comments

Comments
 (0)