-
Notifications
You must be signed in to change notification settings - Fork 26
59 lines (50 loc) · 1.91 KB
/
Copy pathdocker-export.yml
File metadata and controls
59 lines (50 loc) · 1.91 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
name: Build and Push Docker Image
on:
workflow_run:
workflows: ["Semantic Release"]
types:
- completed
jobs:
build-and-push:
# Only run if new release from Semantic release
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04-arm
steps:
- name: Check out repository
uses: actions/checkout@v3
# Log into vortex container registry
- name: Log into GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# vcs to add other repos to src
- name: download vcs
run: |
sudo apt update
pip3 install vcstool
# Get current latest tag from the repository
- name: get latest tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
with:
semver_only: true
# Main logic for creating workspace, installing packages and building image
- name: build ws and run script
run: |
cd ..
mkdir -p ./ros2_ws/src
cp -r vortex-auv ./ros2_ws/src/vortex-auv
cd ros2_ws
vcs import src < ./src/vortex-auv/dependencies.repos
chmod +x ./src/vortex-auv/docker/build.sh
./src/vortex-auv/docker/build.sh
- name: Retag Docker image for GitHub Container Registry
run: |
docker tag auv-image:latest ghcr.io/${{ github.repository_owner }}/auv-image:${{ steps.get-latest-tag.outputs.tag }}
docker tag auv-image:latest ghcr.io/${{ github.repository_owner }}/auv-image:latest
- name: Push Docker image to GitHub Container Registry
run: |
docker push ghcr.io/${{ github.repository_owner }}/auv-image:${{ steps.get-latest-tag.outputs.tag }}
docker push ghcr.io/${{ github.repository_owner }}/auv-image:latest