Update runner type #326
Workflow file for this run
This file contains hidden or 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: ci | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
- name: Style / Format | |
shell: Rscript {0} | |
run: styler::style_dir(dry="fail") | |
- name: Lint | |
shell: Rscript {0} | |
run: | | |
lintr::lint_dir('.') | |
image: | |
needs: build | |
# only on main and dev branch | |
if: startsWith(github.ref, 'refs/heads/main') || github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Pull Image Data | |
run: make pull_data | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: cmu-delphi-deploy-machine | |
password: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }} | |
- name: Build Image | |
env: | |
DEVOPS_DOCKER_FILE: ./devops/Dockerfile | |
run: | | |
docker build -t repo --file ${DEVOPS_DOCKER_FILE} . | |
- name: Resolve Tag | |
id: tagname | |
run: | | |
baseRef="${GITHUB_REF#*/}" | |
imageTag="${baseRef#*/}" | |
if [ "$imageTag" = "main" ] ; then | |
imageTag="latest" | |
fi | |
echo "tag=$imageTag" >> "$GITHUB_OUTPUT" | |
echo "repo=ghcr.io/${{ github.repository }}" >> "$GITHUB_OUTPUT" | |
- name: Push Dev Tag | |
run: | | |
docker tag repo ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }} | |
docker push ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }} | |
- name: Set up Python 3.8 | |
if: startsWith(github.ref, 'refs/heads/main') | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Extract version | |
if: startsWith(github.ref, 'refs/heads/main') | |
id: extract_version | |
run: | | |
python -m pip install bump2version | |
currentVersion=`bump2version --dry-run --list patch | grep ^current_version | sed -r s,"^.*=",,` | |
echo "version=$currentVersion" >> "$GITHUB_OUTPUT" | |
- name: Trigger Webhook | |
run: | | |
# trigger a webhook update | |
curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \ | |
-X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \ | |
-H "Content-Type: application/x-www-form-urlencoded" \ | |
-d "repository=${{ steps.tagname.outputs.repo }}&tag=${{ steps.tagname.outputs.tag }}" | |
- name: Push Version Tag Tag | |
if: startsWith(github.ref, 'refs/heads/main') | |
run: | | |
docker tag repo ${{ steps.tagname.outputs.repo }}:v${{ steps.extract_version.outputs.version }} | |
docker push ${{ steps.tagname.outputs.repo }}:v${{ steps.extract_version.outputs.version }} |