Skip to content

Initial commit of new pipeline. #11

Initial commit of new pipeline.

Initial commit of new pipeline. #11

Workflow file for this run

name: CI Pipeline
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
# Checks for changes in version.txt (used for release job)
changes:
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.filter.outputs.version_changed }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
version_changed:
- 'version.txt'
build:
needs: changes
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Create Artifact
run: |
mkdir -p dist
echo "This is a generated artifact for ${{ matrix.os }}" > dist/cover-agent-${{ matrix.os }}.txt
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: cover-agent-${{ matrix.os }}
path: dist/cover-agent-${{ matrix.os }}.txt
release:
needs: [build, changes]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changes.outputs.version_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: cover-agent-ubuntu-latest
path: dist/ubuntu-latest
- uses: actions/download-artifact@v2
with:
name: cover-agent-windows-latest
path: dist/windows-latest
- uses: actions/download-artifact@v2
with:
name: cover-agent-macos-latest
path: dist/macos-latest
- name: Extract version
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset (Ubuntu)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/ubuntu-latest/cover-agent-ubuntu-latest.txt
asset_name: cover-agent-ubuntu.txt
asset_content_type: text/plain
- name: Upload Release Asset (Windows)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/windows-latest/cover-agent-windows-latest.txt
asset_name: cover-agent-windows.txt
asset_content_type: text/plain
- name: Upload Release Asset (macOS)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/macos-latest/cover-agent-macos-latest.txt
asset_name: cover-agent-macos.txt
asset_content_type: text/plain