-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial draft for wing deployment action blog post #610
Draft
skorfmann
wants to merge
1
commit into
main
Choose a base branch
from
skorfmann/wing-github-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,71 @@ | ||||||
--- | ||||||
title: The Wing Github Action | ||||||
description: Unlocking CI/CD with the Wing Github Action! | ||||||
authors: | ||||||
- skorfmann | ||||||
tags: [winglang, github actions, ci/cd] | ||||||
hide_table_of_contents: true | ||||||
--- | ||||||
|
||||||
> Unlocking CI/CD with the Wing Github Action! | ||||||
> <!--truncate--> | ||||||
|
||||||
Winglang is a specialized programming language designed for cloud applications. It smoothly integrates infrastructure and application code, enabling developers to optimize their workflow. This language translates into Infrastructure as Code (IaC) configurations, such as Terraform or CloudFormation, for cloud resources, and utilizes JavaScript for executing business logic. Importantly, neither Winglang nor its Command Line Interface (CLI) assume how users deploy applications using Terraform. For those utilizing GitHub, we've developed a dedicated Winglang GitHub Action. | ||||||
|
||||||
GitHub Actions is a renowned automation platform within GitHub, facilitating developers in tailoring, executing, and automating their software development workflows directly within their repositories. From building and deploying applications to automating routine tasks like responding to issues, GitHub Actions enhances continuous integration and continuous deployment (CI/CD) by initiating workflows in reaction to specific events, including push and pull requests or defined schedules. | ||||||
|
||||||
While developers have the autonomy to create a custom workflow integrating Winglang with GitHub Actions, the Wing GitHub Action is designed to be comprehensive and simplify the Wing and Terraform setup process. Our objective is to enable rapid deployment and introduce standardized deployment workflows. | ||||||
|
||||||
### Wing Action | ||||||
|
||||||
The [Wing Github Action](https://github.com/winglang/wing-github-action) enables two use-cases at the moment: | ||||||
|
||||||
#### 1. Deployments | ||||||
|
||||||
To begin, here is the basic configuration for deployments: | ||||||
|
||||||
```yml | ||||||
steps: | ||||||
- name: Deploy Winglang App | ||||||
uses: winglang/wing-github-action/actions/deploy@0.1.0 | ||||||
with: | ||||||
entry: 'main.wing' # Required, replace this with your entry file if different | ||||||
target: 'tf-aws' # Required, the target to deploy to. e.g. tf-aws, tf-gcp, tf-azure | ||||||
env: | ||||||
TF_BACKEND_BUCKET: '<your-bucket-name>' # required | ||||||
TF_BACKEND_BUCKET_REGION: '<your-bucket-region>' # required | ||||||
``` | ||||||
|
||||||
This does exactly what you think it might do. It compiles the Wing application to Terraform and Javascript to eventually run a Terraform apply. Right now, a S3 bucket is the only [Terraform backend](https://www.winglang.io/docs/guides/terraform-backends) which is supported - however, there's an open issue to allow defining your own via Wing compiler plugins. Other than that, the action is fully self contained and includes all neccessary dependencies. | ||||||
|
||||||
#### 2. Pull Request Diffs | ||||||
|
||||||
The configuration for pull request diffs closely resembles the deployment setup, with the primary distinction being the `github-token``, necessary for posting comments on pull requests: | ||||||
|
||||||
```yml | ||||||
steps: | ||||||
- name: Pull Request Diff | ||||||
uses: winglang/wing-github-action/actions/pull-request-diff@main | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the version from @main? Or do you want to link to a specific release, like you're doing on the deployment action? |
||||||
with: | ||||||
entry: 'main.wing' # Required, replace this with your entry file if different | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
target: 'tf-aws' # Required, the target to deploy to. e.g. tf-aws, tf-gcp, tf-azure | ||||||
github-token: '' # Required, e.g. ${{ secrets.GITHUB_TOKEN }} | ||||||
env: | ||||||
TF_BACKEND_BUCKET: '<your-bucket-name>' # required | ||||||
TF_BACKEND_BUCKET_REGION: '<your-bucket-region>' # required | ||||||
``` | ||||||
|
||||||
Optimally, this functionality is used in conjunction with the deploy action. It presumes a state storage pattern based on the branch names of the git project. This configuration then generates a Terraform plan which the action captures, posting it as a comment on the triggering pull request. | ||||||
|
||||||
![](./assets/wing-action-diff-comment.png) | ||||||
|
||||||
#### Example | ||||||
|
||||||
For a practical demonstration, explore the [Voting App](https://github.com/winglang/voting-app), which employs both the deployment and pull request diff actions. | ||||||
|
||||||
### Conclusion | ||||||
|
||||||
Make sure to check the [Winglang Docs](https://www.winglang.io/docs/guides/ci-cd#wing-github-action) for the Wing Github Action and custom Github workflows. Also, if you want to learn more about the implementation of those actions head over to the [wing-github-action](https://github.com/winglang/wing-github-action) repository. Contributions are highly encouraged! | ||||||
|
||||||
As always, we welcome any feedback and would love to hear from you! Come join our | ||||||
[community slack](https://t.winglang.io/slack) and share your thoughts on the Wing Github Action. As well check out and :star: our [Github repo](https://github.com/winglang/wing) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.