Skip to content

Commit d7b6285

Browse files
authored
Merge pull request #8 from AntChainOpenLabs/chores/smartir-release
chores: add release ci
2 parents fd46e13 + 48aec70 commit d7b6285

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
permissions:
7+
contents: write
8+
jobs:
9+
Artifact: # Pack and publish to Github Artifact
10+
runs-on: ubuntu-latest
11+
container:
12+
image: smartir/smart-ir-builder:main
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
- name: Build the Release
19+
working-directory: ir_cli
20+
run: |
21+
rustup default 1.67
22+
make release
23+
ls _build # there should be a ir.tgz file under the ir_cli/_build directory
24+
- name: Upload Artifact to Github Releases
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: ir-linux-amd64-nightly
28+
path: ir_cli/_build/ir.tgz
29+
30+
Docker: # Download from Github Artifact and build Docker image and push
31+
runs-on: ubuntu-latest
32+
needs: [Artifact]
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0
38+
- name: Download from Artifact
39+
uses: actions/download-artifact@v3
40+
with:
41+
name: ir-linux-amd64-nightly
42+
path: tmp
43+
- name: Check downloaded contents
44+
run: |
45+
mkdir -p _build/sir
46+
tar -xf tmp/ir.tgz -C _build/sir
47+
ls _build/sir
48+
- name: Login to Docker Hub
49+
uses: docker/login-action@v2
50+
with:
51+
username: ${{ secrets.DOCKER_USERNAME }}
52+
password: ${{ secrets.DOCKER_PASSWORD }}
53+
- name: Extract Metadata (tags, labels) for Docker
54+
id: meta
55+
uses: docker/metadata-action@v4
56+
with:
57+
images: smartir/cli
58+
- name: Build and Push Docker image
59+
uses: docker/build-push-action@v3
60+
with:
61+
context: .
62+
push: ${{ github.event_name != 'pull_request' }}
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}
65+

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM centos:centos8
2+
COPY _build/sir /sir
3+
COPY ir_example/hello_world.ir /sir/example/hello_world.ir
4+
5+
RUN chmod +x /sir/bin/ir_cli
6+
7+
ENV PATH="/sir/bin:${PATH}"
8+
ENV LANG=en_US.utf8

docker/ir-cli-builder/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ docker run --platform linux/x86_64 -v ${path-to-Smart-Intermediate-Representatio
1515

1616
# 3. code, build, test in your container:
1717
cd /home/Smart-Intermediate-Representation-project
18+
# set up default rustup version
19+
rustup default 1.67
1820
make install-rustc-wasm
1921
make run-debug
2022
```

0 commit comments

Comments
 (0)