Release Akto puppeteer service #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Akto puppeteer service | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
required: true | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Add version.txt | |
run: echo ${{ github.event.inputs.release_version }} > version.txt | |
- name: DockerHub login | |
env: | |
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} | |
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
run: | | |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | |
- name: Build, tag, and push the image to DockerHub | |
env: | |
DOCKERHUB_REPOSITORY: aktosecurity/akto-puppeteer-replay | |
IMAGE_TAG_1: latest | |
IMAGE_TAG_2: ${{ github.event.inputs.release_version }}_latest | |
run: | | |
docker buildx create --use | |
docker buildx build --platform linux/arm64/v8,linux/amd64 -t $DOCKERHUB_REPOSITORY:$IMAGE_TAG_1 -t $DOCKERHUB_REPOSITORY:$IMAGE_TAG_2 . --push | |
- name: Configure AWS Credentials for ECR | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}} | |
aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
mask-password: 'true' | |
registry-type: public | |
- name: Build, tag, and push docker image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: akto-puppeteer-replay | |
REGISTRY_ALIAS: p7q3h0z2 | |
IMAGE_TAG: latest | |
IMAGE_TAG_2: ${{ github.event.inputs.release_version }}_latest | |
run: | | |
docker buildx create --use | |
docker build -t $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$REGISTRY_ALIAS/$ECR_REPOSITORY:$IMAGE_TAG_2 . --push | |
- name: Push git tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ github.event.inputs.release_version }} | |
- name: Create a GitHub release | |
uses: ncipollo/[email protected] | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
omitBody: true |