update workflow to set output for version using new syntax #15
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
| on: push | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install -y rpm | |
| sudo gem install fpm package_cloud | |
| - name: Build | |
| run: | | |
| make deb | |
| make rpm | |
| - name: Deploy | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| run: | | |
| PACKAGECLOUD_REPO="cs50/repo" | |
| # Deploy deb to ubuntu repos | |
| UBUNTU_REPOS=( xenial yakkety zesty artful bionic cosmic disco eoan focal groovy hirsute impish jammy ) | |
| for repo in "${UBUNTU_REPOS[@]}"; do | |
| package_cloud push "$PACKAGECLOUD_REPO"/ubuntu/"$repo" build/deb/*.deb | |
| done | |
| # Deploy rpm to fedora repos | |
| for repo in $(seq 28 36); do | |
| package_cloud push "$PACKAGECLOUD_REPO"/fedora/"$repo" build/rpm/*.rpm | |
| done | |
| env: | |
| PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} | |
| - name: Extract version from Makefile | |
| id: make_version | |
| run: | | |
| echo "version=$(make version)" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| github.rest.repos.createRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag_name: "v${{ steps.make_version.outputs.version }}", | |
| tag_commitish: "${{ github.sha }}" | |
| }) |