Skip to content

Commit 8234b24

Browse files
authored
Merge pull request #81 from rancher/chore/migrate-to-github-actions
Migrate to Git Hub Actions
2 parents 217a573 + f2b88ab commit 8234b24

File tree

3 files changed

+106
-207
lines changed

3 files changed

+106
-207
lines changed

.drone.yml

-207
This file was deleted.

.github/workflows/build.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout Code
10+
uses: actions/checkout@v4
11+
- name: Run Dapper CI
12+
run: make build

.github/workflows/release.yml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Release
2+
on:
3+
push:
4+
tags: 'v*'
5+
6+
# Needed to create the release
7+
permissions:
8+
contents: write
9+
id-token: write
10+
11+
# Needed to create the release and use gh cli
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
16+
jobs:
17+
create-release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout Code
21+
uses: actions/checkout@v4
22+
- name: Create a Release
23+
id: create_release
24+
uses: actions/create-release@v1
25+
with:
26+
tag_name: ${{ github.ref }}
27+
release_name: Release ${{ github.ref_name }}
28+
prerelease: true
29+
30+
build-and-push-amd64:
31+
runs-on: ubuntu-latest
32+
needs: [create-release]
33+
steps:
34+
- name: Checkout Code
35+
uses: actions/checkout@v4
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
- name: Set up QEMU
39+
uses: docker/setup-qemu-action@v3
40+
- name: Run Dapper CI
41+
run: make ci
42+
- name: Generate Checksum
43+
run: |
44+
cd dist/artifacts
45+
sha256sum * > sha256sum-amd64.txt
46+
- name: Upload Assets
47+
run: |
48+
ASSETS_DIR="dist/artifacts"
49+
TAG=${{ github.ref_name }}
50+
for file in $ASSETS_DIR/*; do
51+
gh release upload $TAG $file --repo ${{ github.repository }}
52+
done
53+
- name: Build Manifest
54+
id: metadata
55+
uses: docker/metadata-action@v5
56+
with:
57+
images: |
58+
docker.io/rancher/rancher-csp-adapter
59+
709825985650.dkr.ecr.us-east-1.amazonaws.com/suse/rancher/rancher-csp-adapter
60+
709825985650.dkr.ecr.us-east-1.amazonaws.com/suse/rancher/rancher-csp-adapter-eu
61+
flavor: |
62+
latest=false
63+
- name: Read Secrets
64+
uses: rancher-eio/read-vault-secrets@main
65+
with:
66+
secrets: |
67+
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME
68+
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
69+
secret/data/github/repo/${{ github.repository }}/aws/aws-rancher-csp-adapter-ecr/credentials | ECR_ACCESS_KEY
70+
secret/data/github/repo/${{ github.repository }}/aws/aws-rancher-csp-adapter-ecr/credentials | ECR_SECRET_KEY
71+
- name: Login to Docker Registry
72+
uses: docker/login-action@v3
73+
with:
74+
username: ${{ env.DOCKER_USERNAME }}
75+
password: ${{ env.DOCKER_PASSWORD }}
76+
- name: Configure AWS credentials
77+
uses: aws-actions/configure-aws-credentials@v4
78+
with:
79+
aws-access-key-id: ${{ env.ECR_ACCES_KEY }}
80+
aws-secret-access-key: ${{ env.ECR_SECRET_KEY }}
81+
aws-region: us-east-1
82+
- name: Login to Amazon ECR
83+
uses: aws-actions/amazon-ecr-login@v1
84+
with:
85+
registry-type: public
86+
- name: Push Images to Registries
87+
uses: docker/build-push-action@v5
88+
with:
89+
context: .
90+
push: true
91+
tags: ${{ steps.metadata.outputs.tags }}
92+
labels: ${{ steps.metadata.outputs.labels }}
93+
file: package/Dockerfile
94+
platforms: linux/amd64

0 commit comments

Comments
 (0)