Skip to content

Commit af6f035

Browse files
authored
Add release CI jobs and scripts (#9)
Fixes #1
1 parent 1e6bee5 commit af6f035

3 files changed

Lines changed: 111 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2025 Enactic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Release
16+
on:
17+
push:
18+
tags:
19+
- '**'
20+
jobs:
21+
publish:
22+
name: Publish
23+
runs-on: ubuntu-latest
24+
environment: release
25+
permissions:
26+
contents: write
27+
discussions: write
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Create source archive
31+
run: |
32+
git archive ${GITHUB_REF_NAME} \
33+
--prefix openarm-description-${GITHUB_REF_NAME}/ \
34+
--output openarm-description-${GITHUB_REF_NAME}.tar.gz
35+
sha256sum \
36+
openarm-description-${GITHUB_REF_NAME}.tar.gz > \
37+
openarm-description-${GITHUB_REF_NAME}.tar.gz.sha256
38+
sha512sum \
39+
openarm-description-${GITHUB_REF_NAME}.tar.gz > \
40+
openarm-description-${GITHUB_REF_NAME}.tar.gz.sha512
41+
- name: Create GitHub Release
42+
env:
43+
GH_TOKEN: ${{ github.token }}
44+
run: |
45+
version=${GITHUB_REF_NAME}
46+
gh release create ${GITHUB_REF_NAME} \
47+
--discussion-category Announcements \
48+
--generate-notes \
49+
--repo ${GITHUB_REPOSITORY} \
50+
--title "OpenArm Description ${version}" \
51+
--verify-tag \
52+
openarm-description-${GITHUB_REF_NAME}.tar.gz*

dev/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Development
2+
3+
## How to release
4+
5+
```bash
6+
git clone git@github.com:enactic/openarm_description.git
7+
cd openarm_description
8+
dev/release.sh ${VERSION} # e.g. dev/release.sh 1.0.0
9+
```

dev/release.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2025 Enactic, Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -eu
18+
19+
if [ $# -ne 1 ]; then
20+
echo "Usage: $0 version"
21+
echo " e.g.: $0 1.0.0"
22+
exit 0
23+
fi
24+
25+
version="$1"
26+
27+
base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28+
29+
cd "${base_dir}"
30+
31+
if [ "${RELEASE_CHECK_ORIGIN:-yes}" = "yes" ]; then
32+
git_origin_url="$(git remote get-url origin)"
33+
if [ "${git_origin_url}" != "git@github.com:enactic/openarm_description.git" ]; then
34+
echo "This script must be ran with working copy of enactic/openarm_description."
35+
echo "The origin's URL: ${git_origin_url}"
36+
exit 1
37+
fi
38+
fi
39+
40+
if [ "${RELEASE_PULL:-yes}" = "yes" ]; then
41+
echo "Ensure using the latest commit"
42+
git checkout main
43+
git pull --ff-only
44+
fi
45+
46+
if [ "${RELEASE_TAG:-yes}" = "yes" ]; then
47+
echo "Tag"
48+
git tag -a -m "OpenArm Description ${version}" "${version}"
49+
git push origin "${version}"
50+
fi

0 commit comments

Comments
 (0)