Skip to content

Commit

Permalink
Publishing crates on release (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantcornholio authored Aug 22, 2024
1 parent f15393d commit 8890440
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 38 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/docker_publish.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish Docker image and crates

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
images: paritytech/prdoc

- name: Build and push Docker image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 #v4.1.1
with:
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

publish_crates:
name: Publish crates to crates.io
runs-on: ubuntu-latest
container:
image: docker.io/paritytech/ci-unified:bullseye-1.79.0-2024-06-10-v202408151233
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: set version
# removing leading "v" from tag name
run: cargo set-version "$(echo "${{ github.ref_name }}" | sed -e 's/^v//')"

- name: Build and publish prdoclib
run: cargo publish -p prdoclib --token "${CRATESIO_TOKEN}"
env:
CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}

- name: Build and publish prdoc
# `set-version` will change Cargo.toml in `cli` package as it depends on `prdoclib`
# thus, we need --allow-dirty, to include uncommitted changes;
run: cargo publish --allow-dirty -p prdoc --token "${CRATESIO_TOKEN}"
env:
CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }}
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace.package]
version = "0.0.8"
version = "0.0.0-updated-from-ci"
authors = ["chevdor <chevdor@gmail.com>", "Wilfried Kopp <wilfried@parity.io>", "Yuri Volkov <0@mcornholio.ru>"]
edition = "2021"
homepage = "https://github.com/paritytech/prdoc"
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license.workspace = true
readme = "README.md"

[dependencies]
prdoclib = { path = "../prdoclib", version = "0.0.8-beta" }
prdoclib = { path = "../prdoclib", version = "0.0.0-updated-from-ci" }

log = "0.4"
exitcode = "1.1"
Expand Down

0 comments on commit 8890440

Please sign in to comment.