Merge pull request #52 from AntChainOpenLabs/update_tag_publish_crate #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
contents: write | |
jobs: | |
Artifact: # Pack and publish to Github Artifact | |
runs-on: ubuntu-latest | |
container: | |
image: smartir/smart-ir-builder:main | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Build the Release | |
working-directory: ir_cli | |
run: | | |
rustup default 1.70 | |
source /opt/rh/gcc-toolset-11/enable | |
make release | |
ls _build # there should be a ir.tgz file under the ir_cli/_build directory | |
- name: Upload Artifact to Github Releases | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ir-linux-amd64-nightly | |
path: ir_cli/_build/ir.tgz | |
Docker: # Download from Github Artifact and build Docker image and push | |
runs-on: ubuntu-latest | |
needs: [Artifact] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Download from Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ir-linux-amd64-nightly | |
path: tmp | |
- name: Check downloaded contents | |
run: | | |
mkdir -p _build/sir | |
tar -xf tmp/ir.tgz -C _build/sir | |
ls _build/sir | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract Metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: smartir/cli | |
- name: Build and Push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./docker/ir-cli/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |