2022-02-07 03:07:13 +00:00
|
|
|
name: Build Docker image
|
|
|
|
|
2022-03-16 22:13:48 +00:00
|
|
|
on: [push, pull_request]
|
2022-02-07 03:07:13 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
2022-03-04 07:22:27 +00:00
|
|
|
build-container:
|
2022-02-07 03:07:13 +00:00
|
|
|
name: Build and Publish Image
|
|
|
|
if: github.repository_owner == 'mborgerson'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
|
|
- name: Clone Tree
|
|
|
|
uses: actions/checkout@v2
|
2022-03-15 19:11:32 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
2022-02-07 03:07:13 +00:00
|
|
|
|
|
|
|
- name: Extract image metadata (tags, labels)
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v1
|
2022-03-04 07:22:27 +00:00
|
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
2022-02-07 03:07:13 +00:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and push image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2022-02-28 23:26:22 +00:00
|
|
|
context: .
|
2022-03-04 07:22:27 +00:00
|
|
|
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
2022-02-07 03:07:13 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2022-03-04 07:22:27 +00:00
|
|
|
|
|
|
|
build-wheel:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build-container]
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
|
|
|
|
|
|
|
- name: Clone Tree
|
|
|
|
uses: actions/checkout@v2
|
2022-03-15 19:11:32 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
2022-03-04 07:22:27 +00:00
|
|
|
|
|
|
|
- name: Build Test Data
|
|
|
|
run: bash ./scripts/build_test_data.sh
|
|
|
|
|
|
|
|
- name: Build wheel
|
|
|
|
run: |
|
|
|
|
pip install wheel
|
|
|
|
pip install .
|
|
|
|
mkdir /tmp/wheels
|
|
|
|
pip wheel -w /tmp/wheels .
|
|
|
|
mv /tmp/wheels/xemutest-*.whl .
|
|
|
|
|
|
|
|
- name: Get package info
|
|
|
|
run: |
|
|
|
|
echo "TAG_NAME=wheel-$(date -u +'%Y%m%d%H%M')" >> $GITHUB_ENV
|
|
|
|
echo "WHEEL_FILENAME=$(ls *.whl)" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Publish release
|
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
tag_name: ${{ env.TAG_NAME }}
|
|
|
|
name: ${{ env.TAG_NAME }}
|
|
|
|
prerelease: false
|
|
|
|
draft: false
|
|
|
|
files: ${{ env.WHEEL_FILENAME }}
|
|
|
|
- name: Drop outdated wheels
|
|
|
|
uses: dev-drprasad/delete-older-releases@v0.2.0
|
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
|
|
with:
|
|
|
|
keep_latest: 1
|
2022-03-22 22:21:55 +00:00
|
|
|
delete_tag_pattern: wheel-
|
|
|
|
delete_tags: true
|
2022-03-04 07:22:27 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|