name: Publish Packages
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install publishing tools
run: |
pip install twine build
- name: Install repos
run: |
git clone https://github.com/goobits/repos.git
cd repos
cargo build --release
sudo cp target/release/repos /usr/local/bin/
repos --version
- name: Configure npm credentials
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
- name: Configure Cargo credentials
run: |
mkdir -p ~/.cargo
echo "[registry]" > ~/.cargo/credentials.toml
echo "token = \"${{ secrets.CARGO_TOKEN }}\"" >> ~/.cargo/credentials.toml
- name: Configure PyPI credentials
run: |
echo "[distutils]" > ~/.pypirc
echo "index-servers = pypi" >> ~/.pypirc
echo "" >> ~/.pypirc
echo "[pypi]" >> ~/.pypirc
echo "username = __token__" >> ~/.pypirc
echo "password = ${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc
chmod 600 ~/.pypirc
- name: Dry run publish
run: |
repos publish --dry-run
- name: Publish packages
run: |
repos publish --all
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}