Updating workflow to read changelog #25
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: Train model | |
| run: python src/train.py | |
| - name: Build docker image | |
| run: docker build -t ghcr.io/${{ github.repository }}:${{ github.ref_name }} . | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push image | |
| run: docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
| - name: Read Metrics | |
| id: metrics | |
| run: | | |
| content=`cat model/metrics.json` | |
| echo "metrics=$content" >> $GITHUB_OUTPUT | |
| - name: Read Changelog | |
| id: changelog | |
| run: | | |
| content=`cat CHANGELOG.md` | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| echo "$content" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Publish release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| METRICS: ${{ fromJson(steps.metrics.outputs.metrics) }} | |
| with: | |
| files: | | |
| model/metrics.json | |
| generate_release_notes: true | |
| body: | | |
| # Release ${{ github.ref_name }} | |
| ## Model Performance | |
| - RMSE (Test Set): ${{ env.METRICS.rmse }} | |
| - R² Score: ${{ env.METRICS.r2 }} | |
| ## Changelog | |
| ${{ steps.changelog.outputs.changelog }} | |
| ## Technical Details | |
| - Python 3.11 | |
| - Docker image available at: ghcr.io/${{ github.repository }}:${{ github.ref_name }} |