Skip to content

Commit

Permalink
Merging in upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
swhite-oreilly committed Oct 23, 2023
2 parents 076892d + 4d35ec1 commit 3907e1c
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 2 deletions.
57 changes: 56 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
go install golang.org/x/lint/golint@latest
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check Formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
Expand All @@ -35,3 +35,58 @@ jobs:
- name: Build Project
run: |
make
docker_build:
runs-on: ubuntu-22.04
name: Docker Build
if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == 'rebuy-de/aws-nuke' && github.event.pull_request.user.login != 'dependabot[bot]')

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate image tags
shell: bash
run: |
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
BRANCH="$(echo ${GITHUB_HEAD_REF} | tr '/' '_')"
echo "tags=quay.io/rebuy/aws-nuke:${BRANCH},docker.io/rebuy/aws-nuke:${BRANCH}" >> $GITHUB_OUTPUT
else
echo "tags=quay.io/rebuy/aws-nuke:main,docker.io/rebuy/aws-nuke:main,\
quay.io/rebuy/aws-nuke:latest,docker.io/rebuy/aws-nuke:latest" >> $GITHUB_OUTPUT
fi
id: generate_tags

- name: Set up QEMU
if: github.event_name != 'pull_request'
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.generate_tags.outputs.tags }}
platforms: ${{ github.event_name != 'pull_request' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
70 changes: 69 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ on:
types: [created]

jobs:
update_readme:
name: Update Readme
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Update versions in readme
run: |
sed -r -i "s/aws-nuke:v[0-9]+\.[0-9]+\.[0-9]+/aws-nuke:${{ github.ref_name }}/" README.md
sed -r -i "s/aws-nuke-v[0-9]+\.[0-9]+\.[0-9]+/aws-nuke-${{ github.ref_name }}/" README.md
sed -r -i "s/\/v[0-9]+\.[0-9]+\.[0-9]+\//\/${{ github.ref_name }}\//" README.md
- uses: peter-evans/create-pull-request@v5
name: Create Pull Request
with:
title: Update readme for ${{ github.ref_name }} release
commit-message: Update readme for ${{ github.ref_name }} release
body: Updating version references in the readme to ${{ github.ref_name }}
branch: update-readme-${{ github.ref_name }}
delete-branch: true

release:
name: Publish binaries
Expand All @@ -15,7 +37,7 @@ jobs:
with:
go-version: '1.21'
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Project binaries
Expand All @@ -31,3 +53,49 @@ jobs:
tag: ${{ github.ref }}
overwrite: true
file_glob: true

docker_build:
runs-on: ubuntu-22.04
name: Docker Build

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate image tags
shell: bash
run: echo "tags=quay.io/rebuy/aws-nuke:${GITHUB_REF#refs/tags/},docker.io/rebuy/aws-nuke:${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
id: generate_tags

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.generate_tags.outputs.tags }}
platforms: linux/amd64,linux/arm64

0 comments on commit 3907e1c

Please sign in to comment.