Skip to content

Commit

Permalink
Initial commit of new pipeline. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmbeddedDevops1 authored May 28, 2024
1 parent 33a23dc commit 6a73226
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 12 deletions.
81 changes: 70 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- main

jobs:
# Checks for changes in version.txt (used for release job)
changes:
runs-on: ubuntu-latest
outputs:
Expand All @@ -20,23 +21,81 @@ jobs:
with:
filters: |
version_changed:
- 'version.txt' # Adjust the path as needed
- 'version.txt'
test:
runs-on: ubuntu-latest
build:
needs: changes
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Echo Test
run: echo "This is supposed to be a test job"
- 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: [test, changes]
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: Debug Output
run: |
echo "Event: ${{ github.event_name }}, Branch: ${{ github.ref }}"
- 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: cat version.txt

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
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.2
0.0.3

0 comments on commit 6a73226

Please sign in to comment.