Skip to content

Commit

Permalink
Make info change only on VERSION change
Browse files Browse the repository at this point in the history
  • Loading branch information
almahmoud committed Sep 14, 2023
1 parent ad1207e commit 3bb28f8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/build_ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ jobs:
uses: almahmoud/free-root-space@v1
with:
verbose: true

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Login to GHCR
uses: docker/login-action@v2
Expand All @@ -44,6 +46,17 @@ jobs:
fi
echo "CONTAINER_VERSION=$devversion" >> $GITHUB_OUTPUT
- name: Get list of changed files if on push (check if VERSION changed)
id: changed
if: github.event_name == 'push'
run: |
git diff --name-only ${{ github.event.before }} ${{ github.event.after }} > tmpchanged
if grep -xq "^${{ matrix.base.directory }}/VERSION$" tmpchanged; then
echo "CHANGED=TRUE" >> $GITHUB_OUTPUT
else
echo "CHANGED=FALSE" >> $GITHUB_OUTPUT
fi
- name: Extract metadata for container image
id: meta
uses: docker/metadata-action@v4
Expand All @@ -61,14 +74,18 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- run: |
- name: Generate info JSON with Broad script
if: steps.changed.outputs.CHANGED == 'TRUE'
run: |
mkdir -p ${{ matrix.base.directory }}/info
mkdir -p /tmp/${{ matrix.base.directory }}
docker run --name ${{ matrix.base.directory }} -d ${{ steps.meta.outputs.tags }}
docker run --name ${{ matrix.base.directory }} -d ${{ steps.meta.outputs.tags }}
sed -i "s/##${{matrix.base.directory}}-VERSION##/$(cat ${{matrix.base.directory}}/VERSION)/g" config/conf.json
bash scripts/generate_packages.sh ${{ matrix.base.directory }}
cp -r ${{ matrix.base.directory }}/info /tmp/${{ matrix.base.directory }}/
- name: Push
- name: Push info
if: steps.changed.outputs.CHANGED == 'TRUE'
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
Expand Down
4 changes: 2 additions & 2 deletions config/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"tidyverse"
]
},
"version" : "3.17.0",
"version" : "##anvil-rstudio-bioconductor-VERSION##",
"automated_flags" : {
"generate_docs" : true,
"include_in_ui" : true,
Expand All @@ -47,7 +47,7 @@
"tidyverse"
]
},
"version" : "3.18.0",
"version" : "##anvil-rstudio-bioconductor-devel-VERSION##",
"automated_flags" : {
"generate_docs" : true,
"include_in_ui" : true,
Expand Down
2 changes: 2 additions & 0 deletions scripts/generate_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ if __name__ == '__main__':
EOF

sed -i "s/##$IMAGEDIR-VERSION##/$(cat $IMAGEDIR/VERSION)/g"

cd .. && python scripts/generate_packages.py $IMAGEDIR

0 comments on commit 3bb28f8

Please sign in to comment.