-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add daily-build * [WIP] refactor to use base-images directory
- Loading branch information
1 parent
56ff43f
commit d672ccc
Showing
1 changed file
with
93 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
schedule: | ||
# build daily | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
# phase 1 | ||
list: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
component_matrix: ${{ steps.ns_list.outputs.output_matrix }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
base_images | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: setup base images directory | ||
run: | | ||
mv base_images/* . | ||
rm -rf base_images | ||
- uses: viash-io/viash-actions/setup@v6 | ||
|
||
- id: ns_list | ||
uses: viash-io/viash-actions/ns-list@v6 | ||
with: | ||
engine: docker | ||
format: json | ||
|
||
# phase 2 | ||
build: | ||
needs: list | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
component: ${{ fromJson(needs.list.outputs.component_matrix) }} | ||
|
||
steps: | ||
# Remove unnecessary files to free up space. | ||
- uses: data-intuitive/reclaim-the-bytes@v2 | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
base_images | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: setup base images directory | ||
run: | | ||
mv base_images/* . | ||
rm -rf base_images | ||
- uses: viash-io/viash-actions/setup@v6 | ||
|
||
- name: Login to container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_PAT }} | ||
|
||
- name: Build image | ||
run: | | ||
viash run ${{matrix.component.config}} -- \ | ||
---engine docker \ | ||
---setup build \ | ||
---verbose | ||
# only push the image if event is not a pull request | ||
- name: Push image | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
viash run ${{matrix.component.config}} -- \ | ||
---engine docker \ | ||
---setup push \ | ||
---verbose |