Skip to content

Commit 2a71e09

Browse files
committed
replace gocd pipeline with gha pipeline
1 parent 59ded1c commit 2a71e09

File tree

3 files changed

+44
-54
lines changed

3 files changed

+44
-54
lines changed

.github/workflows/pipeline.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
verify_version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- run: |
14+
/bin/bash -c "./tasks verify_version"
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- run: |
20+
sudo git clone https://github.com/bats-core/bats-core /opt/bats-core
21+
sudo git clone https://github.com/bats-core/bats-assert /opt/bats-assert
22+
sudo git clone https://github.com/bats-core/bats-support /opt/bats-support
23+
cd /opt/bats-core && ./install.sh /usr/local
24+
/bin/bash -c "./tasks test"
25+
release:
26+
runs-on: ubuntu-latest
27+
needs: [verify_version, test]
28+
if: github.ref == 'refs/heads/main'
29+
steps:
30+
- uses: actions/checkout@v4
31+
- run: |
32+
/bin/bash -c "./tasks release"
33+
publish:
34+
runs-on: ubuntu-latest
35+
needs: [release]
36+
environment: test
37+
if: github.ref == 'refs/heads/main'
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Publish
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
43+
run: |
44+
/bin/bash -c "./tasks publish"

pipeline.gocd.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

tasks

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ case "${command}" in
4141
;;
4242
publish)
4343
# publish the just released version
44-
GITHUB_TOKEN=$(vault read -field=token secret/gocd/github_releases)
45-
export GITHUB_TOKEN
4644
VERSION=$(releaser::get_last_git_tagged_version)
4745
releaser::prepare_github_release_bin
4846
$GHRELEASE_BIN release \
@@ -58,12 +56,6 @@ case "${command}" in
5856
--name "docker-ops" \
5957
--file src/docker-ops
6058
;;
61-
generate_vault_token)
62-
vault_token=$(vault token create -ttl=48h -policy=gocd -field token -metadata gocd_renew=true)
63-
secured_token_gocd=$(secret_ops::encrypt_with_gocd_top "${vault_token}")
64-
echo "Generated token: ${vault_token} and encrypted by GoCD server"
65-
secret_ops::insert_vault_token_gocd_yaml "${secured_token_gocd}"
66-
;;
6759
*)
6860
echo "Invalid command: '${command}'"
6961
exit 1

0 commit comments

Comments
 (0)