Release #81
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
| name: Release | |
| on: | |
| workflow_run: | |
| workflows: [CI] | |
| types: [completed] | |
| branches: [main] | |
| jobs: | |
| release: | |
| if: github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| environment: production | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: src/go.mod | |
| - run: make release | |
| - name: Determine version | |
| id: version | |
| run: echo "version=$(grep 'Version' src/internal/version.go | head -1 | sed 's/.*"\(.*\)".*/\1/')" >> "$GITHUB_OUTPUT" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: v${{ steps.version.outputs.version }} | |
| generate_release_notes: true | |
| make_latest: true | |
| files: | | |
| build/factorly-${{ steps.version.outputs.version }}-linux-amd64 | |
| build/factorly-${{ steps.version.outputs.version }}-darwin-amd64 | |
| build/factorly-${{ steps.version.outputs.version }}-darwin-arm64 | |
| build/factorly-${{ steps.version.outputs.version }}-windows-amd64.exe | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Publish to npm | |
| working-directory: npm | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| PUBLISHED=$(npm view factorly version 2>/dev/null || echo "none") | |
| if [ "$CURRENT" = "$PUBLISHED" ]; then | |
| echo "npm factorly@$CURRENT already published, skipping" | |
| else | |
| npm publish | |
| fi | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Publish to PyPI | |
| working-directory: pip | |
| run: | | |
| pip install build twine | |
| CURRENT=$(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))") | |
| PUBLISHED=$(pip index versions factorly 2>/dev/null | grep -oP 'factorly \(\K[^)]+' || echo "none") | |
| if [ "$CURRENT" = "$PUBLISHED" ]; then | |
| echo "PyPI factorly@$CURRENT already published, skipping" | |
| else | |
| python -m build | |
| twine upload dist/* | |
| fi | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |