Skip to content

ci: also pass github token #2

ci: also pass github token

ci: also pass github token #2

Workflow file for this run

name: release
on:
workflow_call:
jobs:
init:
runs-on: ubuntu-latest
outputs:
version: ${{steps.version.outputs.version}}
prerelease: ${{steps.state.outputs.prerelease}}
steps:
- name: Evaluate state
id: state
env:
HEAD_REF: ${{github.head_ref}}
run: |
test -z "${HEAD_REF}" && (echo 'do-publish=true' >> $GITHUB_OUTPUT)
if [[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo release=true >> $GITHUB_OUTPUT
elif [[ "${{ github.event.ref }}" =~ ^refs/tags/v.*$ ]]; then
echo prerelease=true >> $GITHUB_OUTPUT
fi
- name: Set version
id: version
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo "Version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
# ensure that the version of the tag is the version of the crates
ensure-version:
runs-on: ubuntu-latest
needs:
- init
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup cargo-binstall
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Setup cargo-workspaces
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cargo binstall -y cargo-workspaces
- name: Set version
run: |
cargo ws version custom ${{ needs.init.outputs.version }} --all --no-git-commit --force "*" --yes
- name: Ensure this did not change anything
run: |
git diff --exit-code
if [ $? -gt 0 ]; then
echo "::error::Uncommitted changes after setting the version. This indicates that the version of the tag does not align with the version of the crates."
exit 1
fi
# ensure we pass CI
ci:
needs:
- init
uses: .github/workflows/ci.yaml

Check failure on line 67 in .github/workflows/release.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yaml

Invalid workflow file

invalid value workflow reference: no version specified
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
needs:
- init
- ci
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install convco
run: |
curl -sLO https://github.com/convco/convco/releases/download/v0.6.2/convco-ubuntu.zip
unzip convco-ubuntu.zip
chmod a+x convco
sudo mv convco /usr/local/bin
- name: Generate changelog
run: |
convco changelog -s --max-majors=1 --max-minors=1 --max-patches=1 > RELEASE_LOG.md
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: v${{ needs.init.outputs.version }}
run: |
OPTS=""
if [[ "${{ needs.init.outputs.prerelease }}" == "true" ]]; then
OPTS="${OPTS} -p"
fi
gh release create ${OPTS} --title "${{ needs.init.outputs.version }}" -F RELEASE_LOG.md ${TAG}
publish:
needs:
- release
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4
- name: Build | Publish
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}