Merge pull request 'Automatically pull tags on Drone' (#6) from fetch-tags into master
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Cadey Ratio 2020-06-12 12:20:14 +00:00
commit dc2019b86d
6 changed files with 12 additions and 18 deletions

View File

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
## 0.3.2
Automagically fetch tags when running as a drone plugin.
## 0.3.1 ## 0.3.1
Hotfix in json parsing Hotfix in json parsing

2
Cargo.lock generated
View File

@ -326,7 +326,7 @@ dependencies = [
[[package]] [[package]]
name = "gitea-release" name = "gitea-release"
version = "0.3.1" version = "0.3.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"byte-unit", "byte-unit",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "gitea-release" name = "gitea-release"
version = "0.3.1" version = "0.3.2"
authors = ["Christine Dodrill <me@christine.website>"] authors = ["Christine Dodrill <me@christine.website>"]
edition = "2018" edition = "2018"

View File

@ -30,7 +30,7 @@ To use this as a drone plugin, add the following to your `.drone.yml` under the
```yaml ```yaml
- name: auto-release - name: auto-release
image: xena/gitea-release:0.3.1 image: xena/gitea-release:0.3.2
settings: settings:
auth_username: cadey auth_username: cadey
changelog_path: ./CHANGELOG.md changelog_path: ./CHANGELOG.md
@ -47,25 +47,13 @@ To use this as a drone plugin, add the following to your `.drone.yml` under the
Replace the values of the settings as makes sense for your gitea server. The Replace the values of the settings as makes sense for your gitea server. The
`changelog_path` attribute is optional, and will be `./CHANGELOG.md` by default. `changelog_path` attribute is optional, and will be `./CHANGELOG.md` by default.
Note that Drone doesn't clone git tags by default. You will need to add a
tag-fetching step to your Drone config until
[#4](https://tulpa.dev/cadey/gitea-release/issues/4) is fixed. You can do that
by adding this before your auto-release step:
```
- name: fetch tags
image: alpine/git
commands:
- git fetch --tags
```
The default branch will automatically be derived from the Gitea API. If you need The default branch will automatically be derived from the Gitea API. If you need
to hard-code your default branch name for some reason, add the `default_branch` to hard-code your default branch name for some reason, add the `default_branch`
setting like this: setting like this:
```yaml ```yaml
- name: auto-release - name: auto-release
image: xena/gitea-release:0.3.1 image: xena/gitea-release:0.3.2
settings: settings:
auth_username: cadey auth_username: cadey
default_branch: trunk default_branch: trunk

View File

@ -1 +1 @@
0.3.1 0.3.2

View File

@ -25,7 +25,9 @@ pub(crate) async fn run(env: DroneEnv) -> Result<()> {
u.set_username(&env.auth_user).unwrap(); u.set_username(&env.auth_user).unwrap();
u.set_password(Some(&env.token)).unwrap(); u.set_password(Some(&env.token)).unwrap();
repo.remote_delete("origin")?; repo.remote_delete("origin")?;
repo.remote("origin", u.as_str())?; let mut origin = repo.remote("origin", u.as_str())?;
origin.connect(git2::Direction::Fetch)?;
origin.fetch(&["refs/tags/*:refs/tags/*"], None, None)?;
release::run( release::run(
common, common,