Skip to content

Commit faf78bc

Browse files
authored
release workflow on tag push (#7)
1 parent 0255c62 commit faf78bc

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) 2023, Salesforce, Inc.
2+
# SPDX-License-Identifier: Apache-2
3+
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: create release
17+
18+
on:
19+
push:
20+
tags:
21+
- "v*.*.*"
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: get pushed tag
28+
id: get_pushed_tag
29+
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
30+
31+
- uses: actions/checkout@v4
32+
33+
- run: git archive --output=rules_docker_compose-${{ steps.get_pushed_tag.outputs.TAG }}.tar.gz ${{ steps.get_pushed_tag.outputs.TAG }}
34+
35+
- name: get SHA256 of archive
36+
id: get_sha
37+
run: echo "::set-output name=sha::$(sha256sum rules_docker_compose-${{ steps.get_pushed_tag.outputs.TAG }}.tar.gz | cut -f 1 -d ' ')"
38+
39+
- name: Create Release
40+
uses: softprops/action-gh-release@v1
41+
with:
42+
body: |
43+
```
44+
http_archive(
45+
name = "rules_docker_compose",
46+
sha256 = "${{ steps.get_sha.outputs.sha }}",
47+
urls = ["https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/download/${{ steps.get_pushed_tag.outputs.TAG }}/rules_docker_compose-${{ steps.get_pushed_tag.outputs.TAG }}.tar.gz"],
48+
)
49+
```
50+
generate_release_notes: true
51+
files: rules_docker_compose-${{ steps.get_pushed_tag.outputs.TAG }}.tar.gz

0 commit comments

Comments
 (0)