-
Notifications
You must be signed in to change notification settings - Fork 17
68 lines (58 loc) · 2.42 KB
/
docker-base-image.yml
File metadata and controls
68 lines (58 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Docker Base Image CI
on:
push:
branches: [ "base" ]
repository_dispatch:
types: [ build_base ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Step 1: Checkout the repository
- name: Checkout Code
uses: actions/checkout@v4
# Step 2: Log in to GitHub Container Registry
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Step 2: Set environemnt
- name: Set environment
env:
GIT_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "IMAGE_TAG=torchsim-ci:${GITHUB_SHA}" >> $GITHUB_ENV
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}" >> $GITHUB_ENV
echo "GITHUB_SHA=${{github.event.pull_request.head.sha}}"
gem5_response_file=/tmp/releases-gem5-latest.json
curl -s https://api.github.com/repos/PSAL-POSTECH/GEM5/releases/latest > ${gem5_response_file}
GEM5_ASSET_ID=$(jq ".assets[0].id" ${gem5_response_file})
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID"
echo "GEM5_ASSET_ID=$GEM5_ASSET_ID" >> $GITHUB_ENV
llvm_response_file=/tmp/releases-gem5-latest.json
curl -s https://api.github.com/repos/PSAL-POSTECH/llvm-project/releases/latest > ${llvm_response_file}
LLVM_ASSET_ID=$(jq ".assets[0].id" ${llvm_response_file})
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID"
echo "LLVM_ASSET_ID=$LLVM_ASSET_ID" >> $GITHUB_ENV
spike_response_file=/tmp/releases-spike-latest.json
curl -s https://api.github.com/repos/PSAL-POSTECH/riscv-isa-sim/releases/latest > ${spike_response_file}
SPIKE_ASSET_ID=$(jq ".assets[0].id" ${spike_response_file})
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID"
echo "SPIKE_ASSET_ID=$SPIKE_ASSET_ID" >> $GITHUB_ENV
# Step 3: Build and Push Docker Image
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.base
push: true
build-args: |
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
SPIKE_ASSET_ID=${{ env.SPIKE_ASSET_ID }}
tags: ghcr.io/psal-postech/torchsim_base:latest