diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d8fbc5..567e2ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: - main jobs: + # Checks for changes in version.txt (used for release job) changes: runs-on: ubuntu-latest outputs: @@ -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 - \ No newline at end of file + 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 diff --git a/version.txt b/version.txt index 7bcd0e3..6812f81 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.2 \ No newline at end of file +0.0.3 \ No newline at end of file