Create info files #1
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: Create info files | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
base: | |
- {directory: 'anvil-rstudio-bioconductor', image: 'us.gcr.io/broad-dsp-gcr-public/anvil-rstudio-bioconductor:3.19.0'} | |
- {directory: 'anvil-rstudio-bioconductor-devel', image: 'us.gcr.io/broad-dsp-gcr-public/anvil-rstudio-bioconductor-devel:3.20.0'} | |
name: Build branch images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free root space | |
uses: almahmoud/free-root-space@v1 | |
with: | |
verbose: true | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- 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 }} | |
CURR_VERSION=$(cat ${{matrix.base.directory}}/VERSION) | |
docker run --name ${{ matrix.base.directory }} -d us.gcr.io/broad-dsp-gcr-public/${{ matrix.base.directory }}:${CURR_VERSION} | |
sed -i "s/##${{matrix.base.directory}}-VERSION##/${CURR_VERSION}/g" config/conf.json | |
bash scripts/generate_packages.sh ${{ matrix.base.directory }} | |
# Remove spaces | |
(cd ${{ matrix.base.directory }}/info && for file in *; do [[ "$file" == *" "* ]] && mv "$file" "${file// /}"; done) | |
cp -r ${{ matrix.base.directory }}/info /tmp/${{ matrix.base.directory }}/ | |
- name: Push info | |
if: steps.changed.outputs.CHANGED == 'TRUE' | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 50 | |
shell: bash | |
command: | | |
set -x | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git pull origin ${GITHUB_REF#refs/heads/} || git reset --hard origin/${GITHUB_REF#refs/heads/} | |
git config user.name github-actions | |
git config user.email [email protected] | |
cp -r /tmp/${{ matrix.base.directory }}/info ${{ matrix.base.directory }}/ | |
git add ${{ matrix.base.directory }} | |
git commit -m "Generated info for ${{ matrix.base.directory }}" | |
git push |