Skip to content

Commit fdf0660

Browse files
authored
Merge pull request #3 from crenshaw-dev/release
release
2 parents ba84d17 + ebfce01 commit fdf0660

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

.github/workflows/build.yaml

+11-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
branches:
99
- main
1010
types: [ opened, synchronize, reopened ]
11+
workflow_call:
12+
inputs:
13+
tag:
14+
type: string
15+
required: true
1116

1217
permissions:
1318
contents: read
@@ -26,25 +31,25 @@ jobs:
2631
- name: Login to Docker Hub
2732
uses: docker/login-action@v2
2833
with:
29-
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
username: crenshawdotdev
3035
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3136
- name: Build and push
3237
uses: docker/build-push-action@v3
3338
with:
3439
context: .
3540
push: ${{ github.event_name == 'push' }}
36-
tags: crenshawdotdev/argocd-executor-plugin:latest
41+
tags: crenshawdotdev/argocd-executor-plugin:${{ inputs.tag || 'latest' }}
3742
- name: Install cosign
3843
uses: sigstore/cosign-installer@main
3944
with:
4045
cosign-release: 'v1.13.0'
41-
if: ${{ github.event_name == 'push' }}
42-
- name: Sign latest image
46+
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_call' }}
47+
- name: Sign ${{ inputs.tag }} image
4348
run: |
44-
cosign sign --key env://COSIGN_PRIVATE_KEY crenshawdotdev/argocd-executor-plugin:latest
49+
cosign sign --key env://COSIGN_PRIVATE_KEY crenshawdotdev/argocd-executor-plugin:${{ inputs.tag }}
4550
# Displays the public key to share.
4651
cosign public-key --key env://COSIGN_PRIVATE_KEY
4752
env:
4853
COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}}
4954
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
50-
if: ${{ github.event_name == 'push' }}
55+
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_call' }}

.github/workflows/release.yaml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Create argocd-executor-plugin release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
required: true
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build-and-push:
13+
uses: crenshaw-dev/argocd-executor-plugin/.github/workflows/build.yaml@main
14+
with:
15+
tag: ${{ github.event.inputs.tag }}
16+
if: github.repository == 'crenshaw-dev/argocd-executor-plugin'
17+
prepare-release:
18+
permissions:
19+
contents: write # To push changes to release branch
20+
name: Release
21+
if: github.repository == 'crenshaw-dev/argocd-executor-plugin'
22+
runs-on: ubuntu-22.04
23+
env:
24+
GIT_USERNAME: crenshaw-dev
25+
GIT_EMAIL: [email protected]
26+
RELEASE_TAG: ${{ github.event.inputs.tag }}
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Push release tag
35+
run: |
36+
set -ue
37+
38+
git config --global user.email "${GIT_EMAIL}"
39+
git config --global user.name "${GIT_USERNAME}"
40+
41+
git tag ${RELEASE_TAG}
42+
git push origin ${RELEASE_TAG}
43+
44+
- name: Create GitHub release
45+
uses: softprops/action-gh-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
name: ${{ env.RELEASE_TAG }}
50+
tag_name: ${{ env.RELEASE_TAG }}
51+
generate_release_notes: true

0 commit comments

Comments
 (0)